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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I minimize application ?

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi,
can anyone help me out with this one, I'd really appreciate it. I want to minimize my application when I click on the cancel button on my propery sheet. The code below works ok in that the application is minimized. However I can't get it maximized again by clicking on it in the task bar, or right clicking it.

Thanks for yout help

Martin.

BOOL VehicleSheet::OnCommand(WPARAM wParam, LPARAM lParam)
{
if (LOWORD(wParam) == IDCANCEL)
{
CWinApp* pTheApp = AfxGetApp( );
CWnd* pMainWindow = pTheApp->GetMainWnd();
pMainWindow->ShowWindow(SW_MINIMIZE);
return true;
}
 
I think, You should make at lest somewhat like this:
bool IsNotMinimized = true; //Global or in Your CWinApp - derived class
BOOL VehicleSheet::OnCommand(WPARAM wParam, LPARAM lParam)
{
if (LOWORD(wParam) == IDCANCEL && IsNotMinimized)
{
CWinApp* pTheApp = AfxGetApp( );
CWnd* pMainWindow = pTheApp->GetMainWnd();
pMainWindow->ShowWindow(SW_MINIMIZE);
IsNotMinimized = false;
return true;
}
.....
}
and reset IsNotMinimized to true after You maximized Your Window. Better, You should check lParam too. At time, wParam may be allways IDCANCEL, and all time window is minimized.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top