Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Minimizing a window

Status
Not open for further replies.

timmay3141

Programmer
Dec 3, 2002
468
US
I'm running a full screen app using Direct3D (not sure if this is important or not). When I alt+tab out, I want the window to minimize. It does this on its own sometimes, but part of the time it sits there, maximized, and won't give up focus to other windows. I want to get it to minimize every time. Here's what I have in the WindowProc:

switch(msg)
{
case WM_ACTIVATE:
Activate((BOOL)wParam); // Handle DX related activation
if(wParam == FALSE)
{
ShowWindow(hwnd, SW_MINIMIZE);
return 0;
}
else
{
ShowWindow(hwnd, SW_MAXIMIZE);
return 0;
}
break;
// handle other messages
}

It generally minimizes the window, but then it inexplicably reactivates and maximizes the window again most of the time, so I can't get the stupid window to stay minimized. What can I do to fix this problem?
 
>> Direct3D (not sure if this is important or not).

Yes, it is important. D3D has its own behavior to minimize the window when it loses focus, so you shouldn't have to code your own minimize thing.

Maybe, it is not minimizing when you are running it in the debugger and it hits a breakpoint. In which case you must manually minimize it before the breakpoint is reached.

I REALLY hope that helps.
Will
 
I fixed it. This was actually a problem in some games I've played when alt+tabbing, although my friends don't seem to have the same problems with the same games. Regardless, I just took out the line to maximize it and now it works. I've also discovered the problem with breakpoints, and so I run it windowed when debugging.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top