Archived

This topic is now archived and is closed to further replies.

this problem is my nemesis. alt-tab

This topic is 4951 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

You can tab out of my program, but you cannot tab in. I get a "This program is not responding" message when I try to right-click exit it on the taskbar...otherwise I can''t alt-tab back in, I can''t get back in by clicking on its taskbar button, nothing. It''d dead and done once I''ve tabbed out. Here''s my WinMain:
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPreviousInstance, LPSTR lpcmdline, int nCmdShow)
{

	MSG Message;
	while (g_App.GetProgramStatus())
	{		
		if (PeekMessage(&Message, g_App.GetWindowHandle(), 0, 0, PM_REMOVE))
		{
			TranslateMessage(&Message);
			DispatchMessage(&Message);
		}

		//    G  A  M  E       L  O  G  I  C

		if (g_App.GetWindowStatus())
			g_App.TheBrainThatRunsOncePerCycle();

	} // end window while


	return 0;
} // end WinMain

And here''s what I think to be the relevant entry in my message handler:
case WM_ACTIVATE:
	{

	switch (LOWORD(wparam))
		case WA_ACTIVE:
		case WA_CLICKACTIVE:
			{
				if ((HWND)lparam==g_App.GetWindowHandle())
				{
					g_App.SetWindowStatus(true);
				}

			} break;

		case WA_INACTIVE:
			{
				g_App.SetWindowStatus(false);
			} break;

	} // switch (LOWORD(wparam))


} break;

case WM_PAINT:
	{

	// start painting

	hdc = BeginPaint(hWindow,&ps);

	// even though this serves no purpose, windows gets anxiety attacks if you

	// try to respond to this message without actually "using" its own painting routines.

	// windows anxiety attacks are quite bad for your program, you know.


	// end painting

	EndPaint(hWindow,&ps);

	g_App.DDRestoreSurfaces(); // just calls IDirectDraw7::RestoreAllSurfaces if IDirectDraw7::IsLost returns true.

			
} break;
I''m using DirectDraw7, and other than alt-tabbing the game runs fine for what it is. If anyone has any incite please clue me in. I really appreciate everyone''s help.

Share this post


Link to post
Share on other sites