I'm writing a piece of code in Windows which uses both winapi messagebox and some dynamic memory for RS232 application
I saw a strange situation when the same application creates different error when I run it in debugging mode (using VS2010 and step-in debugging) and running it as an executable in command-line
in first case, the error is popped up properly with a winapi messagebox and the program returns/ends properly. Second case, it creates run-time error and also the memory leak
Is there such difference between these two run modes? and how to catch winapi run-time error?
Thanks in advance!
Yes! Running a program directly form the debugger the debug heap is in use. Assuming it isn't compiled in debug mode. And the memory layout changes when the debugger is loaded into the process address space. So some weird things may happen.
If you have such strange effects it is sometimes better to attach the debugger to the running process.