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

Minimize button code changes 1

Status
Not open for further replies.

SmileeTiger

Programmer
Mar 13, 2000
200
US
Hi,

I am trying to have some extra events happen whenever a user presses the minimize button inside a window. What message handler does the minimize button use?

SmileeTiger
 
minimize button respond to WM_LBUTTONDOWN.
The owner window receive in this case message WM_COMMAND with wParam = SC_MINIMIZE. This messsage you can process in your WndProc. Be attentive, don't return 0 on responding to this message. If you want to send a message to a window to minimise, just call
ShowWindow(hWnd,SW_MINIMIZE); John Fill
1c.bmp


ivfmd@mail.md
 
OK.. so I have to add the handler for WM_ONLBUTTONDOWN right?

After doing so I end up with:
void CTmpDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/orcall default

CDialog::OnLButtonDown(nFlags, point);
}

How do I ensure that the user has clicked on the minimize button?

Am I going about this completly wrong?


SmileeTiger
 
Try some thing like it:
void CTmpDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
ShowWindow(SW_MINIMISE);
CDialog::OnLButtonDown(nFlags, point);
}
John Fill
1c.bmp


ivfmd@mail.md
 
Actually that won't do at all.. this code will simply minimize the window whenever the user clicks anywhere in the dialog box with his left mouse button. What I want to do is have an extra evern happen whenever the user clicks the minimize button...


SmileeTiger
 
OK I almost have it working.. what I did was use OnSysCommand to take care of the calls.. however now I want to hide the task bar icon and it isn't working.. I think I need a handle to the taskbar but I am not sure how to det it.. any ideas?

void CTsuRenderCoreConsoleDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if (nID == SC_MINIMIZE) // Decide if minimize state changed
{
this->ShowWindow( SW_HIDE ); //SHould hide the task bar icon here...
MessageBox("Min");
CDialog::OnSysCommand(nID, lParam);//Take careof the normal params
}
else if (nID == SC_RESTORE) {
//SHould show the task bar icon here...
MessageBox("Restore");
CDialog::OnSysCommand(nID, lParam);//Take careof the normal params
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}


SmileeTiger
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top