Program Crash

So I have a program in OpenGL that works on several computers, but when I try to compile it (or run the exe) on one of my desktops I get an access violation exception and VC++ breaks at this line, which lives inside my main loop in WinMain:

if (GetAsyncKeyState(VK_ESCAPE))
shutdown();

If I comment these lines (which are relatively unimportant), an access violation occurs at the very next line. If I comment that line, it crashes on the next, etc etc.

This is particularly troubling because it works fine on another desktop which has the same processor and GPU (AMD Phenom 9950 and ATI Radeon 4850). I’ve also tried several other OpenGL programs, including a few using GLUT to handle the Windows interfacing, and they all crash. Copying the compiled exe also causes runtime access violation.

My drivers are up-to-date. Running Vista 64bit Ultimate. The program works on another PC with Vista 64bit Home and one with XP 32bit.

Anyone have an idea what could be causing this? I can give more details if needed.

do you do some overclocking? seems cpu/gpu is not that stable on your desktop pc. can’t explain why otherwise it runs well on others whereas any GL program crashes on yours. keep in mind that particullary graphics apps tend to heat it up.

I don’t overclock.

I do have a slight heat issue which I’m fixing soon with a better cpu heatsink and another chassis fan, but it’s not serious. CPU & GPU idle at 50C and max out around 70C when I’m playing an intense game or something.

When I run the program in point the CPU and GPU are at 50C.

Also it’s not ANY OGL program, only the ones I write. I can run all kinds of commercial games that utilize ogl.

some memory corruption could cause this say something like this:
// global char array
char g_String[16];
// code to corrupt it
sprintf(g_String,"%s.%d",“string length is beyond 16 bytes”,anyNumber);

debugging and studying the code is the best thing here as noone could tell you for sure.

I was a little confused about what was causing the crash. It seems to be the call to SwapBuffers() inside my loop in WinMain. When I debug step to the call, the value of hdc is this:

0xfe011734 {unused=???}
CXX0030: Error: expression cannot be evaluated

Then I try to make the call and I get this exception:

Unhandled exception at 0x00000000 in Program.exe: 0xC0000005: Acces violation.

I’m not a buff on Windows GUI programming so I’m not sure where to go from here. Anyone see anything?

while (!quit)
	{
		if (PeekMessage(&msg, NULL, NULL, NULL, PM_REMOVE))
		{
			if (msg.message == WM_QUIT)
				quit = true;

			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}

		renderFrame();	//draws the scene

		SwapBuffers(hdc);

		if (GetAsyncKeyState(VK_ESCAPE))
			shutdown();

		think();		//calculates object positions, etc.
	} 

Appears to be a driver issue. I installed an old driver (CCC 8.12) and it worked.

However, whenever I restart my computer the problem starts up again, and I have to reinstall the driver to get things to work.

Anyone know what could be happening?