   VC++6 really irritating bug!
  I program in Visual C++ 6 and I have a big problem:Let's say that I have a small piece of code that creates a window and runs it.  This piece of code works OK, with no problems.Then I decide to change it.  I alter some parts of the code and then press "Execute."  Of course, hardly anyone can write new code with no mistakes at all, so I obviously don't make my changes the correct way every time.Then I press "Execute" again.  If the changes I've made to the code are correct, then nothing bad happens.  But if I did it wrong, all heck breaks loose.  The app will close after running unsuccessfully, as it should.  But then the process for my program (ie. "mywindowsapp.exe") will persist in the Processes section under Task Manager, sometimes locking up the keyboard and sending CPU levels to 100%, until I kill the process.Even after that my problems are not over.  I change my code back to the way it was before, but now it won't execute.  VC++6 gives me a "cannot open debug/myprogram.exe" message.  The code will compile with no errors, but I cannot make the program run!  I can't even run the Clean command, because VC++6 tells me "access to debug/myprogram.exe is denied."  What I eventually have to do is restart the computer.  Once I've restarted, access to myprogram.exe is apparently no longer restricted and I am able to rebuild my program.This is a _huge_ pain.  And it will happen over something fantastically minor, like adding a ShowWindow() command to WinMain or changing from WNDCLASS to WNDCLASSEX.  Sometimes I'm not sure if the changes I make are even incorrect!Please, does anyone know what is going on here?  What is happening exactly when VC++6 creates these undead you-have-to-go-to-Processes-to-finish-them programs?  (I've been suffering with this particular phenomenon for a very long time now.)And why does this happen for such small, perhaps nonexistent, program errors?  Is there some setting I need to change to allow me to write Windows code with more freedom?  I really don't have the patience to go through this ordeal every time I try to execute an incorrectly written Windows program.Any help or info is very much appreciated!   
  There are a few possibilities:1) You are using VC++ 6.  This is a bug in itself.2) Your windows code is incorrect, and the window never properly closes itself.  This is the most likely culprit (well, #1 is pretty bad too)3) You just need to do a Rebuild All.  Especially in VC6, the compiler doesn't always update dependencies perfectly, leading to some bizarre clashes during linking.4) You are using VC++ 6.  I think it's time to upgrade :)   ;  I would guess ... and this is only a guess ... that your message loop is running out of control because you're not calling PostQuitMessage(0) on your WM_DESTROY message handler.:-D;  I think most people will refuse to help you until you upgrade to something better. Visual Studio 6 is very old and buggy. A new and better compiler by Microsft, called Visual Studio 2005, can be found for free here. There is plenty of info on upgrading your apps and on how to change your IDE. You should really do it now, as Visual Studio is very very bad.   ;Quote:Original post by krumI would guess ... and this is only a guess ... that your message loop is running out of control because you're not calling PostQuitMessage(0) on your WM_DESTROY message handler.:-DAh, it's been years since I wrote windows code, but thats exactly the problem I was thinking of (just couldn't remember the details).To OP: krum is probably right.   ;  This problem has little to do with VC6. Your application just isn't properly terminated, so only the window is destroyed but the application is still running (as krum said). Because the executable is still in use, the compiler cannot overwrite it. It gets even worse in debug mode, because the system will not allow the executable to be destroyed from the outside. Usually it should suffice to just kill Visual Studio which will take the debug process down with it. Hope this helps.   ;  krum might be right if this happens every time. However, I had the same issue when I used VC++6, every so often (once in 50 compiles or so) cl.exe failed to exit. This is why it can't output the exe file, if you task manager cl.exe you will be able to compile and have it produce the new executable. I never noticed any specific symptoms that led to this happening like you have listed, but its possible. I only remember it happening on compiles with errors, but never associated the two because it didn't always happen.The solution is to upgrade from VC++ 6, it is basically one gigantic bug.   ;Visual Studio 2005 Express, free from Microsoft.   ;Quote:You are using VC++ 6. I think it's time to upgrade :)the new version whilst much better than vc6 in most reguards its way slower + clunker, thus in windows if i wanna quicky code up a demo i use vc6, even though i have vc express 2005 installed   ;  also, if you havent' already, at least upgrade to VC6 SP5. those service packs fix a lot of bugs.   