|
I have resolved the issue by using the /Op compiler option. The problem is compiler is doing round up when it is getting the answer ( to any expression ) x.999xxxxx (x is any number). And it is storing the X+1 to the left side of the expression. When I do cast of this parameter i am getting the only X.
By using /Op flag for improving the consistency of floating-point tests.
You can test this by the example:
231/0.55= 420.
|
|
|
|
|
Fine that you solved it.
But remember that you are a bit compiler specific here: Neither ohter version of VisualStudo nor different compiler will necessary bring you the same result. Just keep that in mind or maybe create a unit-test for that.
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
Hi there
I have 2 questions:
- How can I know the handle ID of desktop window?
- How can I launch calc, or mspaint applications from my code and if that applications are already opened to activate them?
How to do this or where can I find such examples?
I'm working on MFC.
|
|
|
|
|
duta wrote: - How can I know the handle ID of desktop window?
Are you referring to GetDesktopWindow() ?
duta wrote: - How can I launch calc, or mspaint applications from my code and if that applications are already opened to activate them?
It really depends on how that particular application was coded. Some applications are coded such that they can only exist in memory one time. The first thing to try would be to use CreateProcess() to run the application. The next thing to try would be to use FindWindow() to search for the application's window. If it is found, use BringWindowToTop() .
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I think you said me dont use of FindWindow,right?
|
|
|
|
|
I need to add a button to my form which stops the process,
just like cancel button in install applications.
which way do i have to use?
please somei-one hel me!!!
|
|
|
|
|
Adnan Merter wrote: I need to add a button to my form which stops the process,
just like cancel button in install applications.
What process do you need to stop?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Adnan Merter wrote: I need to add a button to my form which stops the process,
So what do you need help with, adding a button, responding to a button click, or stopping a process?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
i need help about stopping the process
the prcess is driving a stepper motor
i mean the button must stop all actions while my program sending data to parallel port,
just like an emergency "stop button" or "cancel button in install application"
thanks
|
|
|
|
|
Ok, then you'll need at least one other thread for this. Do the work of communicating with the parallel port in the secondary thread. This will free up the primary thread to handle the UI. See here for the way to gracefully stop a thread.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Try some of the following depending on your compiler and environment.
standard:
exit(-1);
Microsoft:
ExitProcess(-1);<br />
TerminateProcess(GetCurrentProcess(),-1);
Microsoft Window:
PostMessage(WM_CLOSE,0,0);
|
|
|
|
|
Hello everyone,
As mentioned here,
http://msdn2.microsoft.com/en-us/library/cc266343.aspx
when we call DebugBreak, the program under \\HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\AeDebug key, will be invoked. The value for mine is,
"C:\Windows\system32\vsjitdebugger.exe" -p %ld -e %ld
In my environment, a dialog will be displayed and Visual Studio 2008 is the only item to select to debug. My question is, why vsjitdebugger.exe is not called as mentioned in MSDN, but Visual Studio 2008 is displayed in the dialog box?
thanks in advance,
George
|
|
|
|
|
What actually happens when you call DebugBreak (on an Intel x86 anyway) is the {int 3}instruction is executed. That's assembly for 'trigger interrupt number 3'. If an interrupt handler is installed for interrupt 3 it will be called. What happens after that is down to the interrupt handler. How to install one? Why Windows pops up the 'Choose a debugger' dialog when there's only one installed? These things are plenty mysterious.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Do you mean 'Choose a debugger' dialog is vsjitdebugger.exe? Matthew?
regards,
George
|
|
|
|
|
No but it might be, that would make sense of the registry entry. Next time it comes up have a look in your task manager and see if the vsjitdebugger process is running only when the dialog is displayed.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Yes, Matthew!
I have found vsjitdebugger in the process list. To be more confident, we need some formal documents to support.
regards,
George
|
|
|
|
|
On a "normal" user's system the default debugger creates a dump file and sends it to Microsoft (assuming you agree). When you install software development software such as MSVC the debugger is changed to the debugger which is part of the IDE so you can debug your software. I use .REG files to switch between various debuggers (WinDBG is extremely powerful but a little annoying to use, MSVC is easy to use but underpowered).
Steve
|
|
|
|
|
Thanks Steve!
Do you know whether the program with 'Choose a debugger' dialog is vsjitdebugger.exe?
regards,
George
|
|
|
|
|
|
Cool, Maximilien!
Question answered.
regards,
George
|
|
|
|
|
Hi can anyone tell me how to create a win32 window using createwindow function from a MFc dialog. The actula problem is that once a button is clicked on the MFC gui a new full screen win32 window is to be created, Where some graphics is drawn ? Have been trying this for many hours and I am relatively new to WINDOWS programming.
Thanks in advance
|
|
|
|
|
What is your problem? Have you doubts on CreateWindow parameters? CreateWindow is not working? Have you some errors?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Thanks for your reply but I have created for a simple app with winmain but not in an MFC app ...
I have got all the attributes required to call the createwindow but the problem is the showwindow requires int n_cmdshow parameter and some of the functions are not taking all the aprameters they have to .... Can somebody give me a sample code to create a win32 window from an MFC dialog application created through wizard...
|
|
|
|
|
ravialla wrote: Can somebody give me a sample code to create a win32 window...
HWND hwnd = CreateWindow("MainClass",
"Test",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
(HWND) NULL,
(HMENU) NULL,
hInstance,
(LPVOID) NULL);
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
ravialla wrote: I have created for a simple app with winmain but not in an MFC app
ravialla wrote: create a win32 window from an MFC dialog application created through wizard
Above statements are contradictory. Can you explain?
If you are using MFC dialog, why in the name of C++ you have to use API to create window?
Derive class from CWnd and call Create member.
If you need more functionality, you can use frame window with view, menu and toolbar.
JohnCz
MS C++ MVP
|
|
|
|