Handling Minimize event
-
I have made a window in Win32. I would like to somehow handle the minimize event, so I can do stuff when the user clicks the minimize button. Does anyone have any clue how to do this? Any help is appreciated. -Dev578
Both of the links I posted to your previous question 'Running a program in the taskbar' show how to handle the minimize event (or, one way of doing it) Did you look at these examples ?? There are plenty of other examples, you can search here, or google In general terms, when designing (say a dialog app), you must set 'Minimise Box' under Dialogue Properties -> Styles. You then write/modify the handler for the 'OnSysCommand' - an example of such is shown below :- void CMBFGWMS1Dlg::OnSysCommand(UINT nID, LPARAM lParam) { if ((nID & 0xFFF0) == IDM_ABOUTBOX) { CAboutDlg dlgAbout; dlgAbout.DoModal(); } else { // Decide if minimize state changed bool bOldMin = bMinimized_; if (nID == SC_MINIMIZE) { bMinimized_ = true; } else if (nID == SC_RESTORE) { bMinimized_ = false; } CDialog::OnSysCommand(nID, lParam); if (bOldMin != bMinimized_) { // Minimize state changed. Create the systray icon and do // custom taskbar button handling. SetupTrayIcon(); SetupTaskBarButton(); } } } the line nID == SC_MINIMIZE is actually the bit that checks to see if the minimise button/request was activated (since there are a number of different requests that all come through OnSysCommand) - this is how the request is handed to your program ... How about you try using one of the examples, and post some code back to CP if you want more help - its easier for us to work with 'posted code' than vapour .... 'G'
-
I have made a window in Win32. I would like to somehow handle the minimize event, so I can do stuff when the user clicks the minimize button. Does anyone have any clue how to do this? Any help is appreciated. -Dev578
OnSize
(with type == SIZE_MINIMIZED) Anyone who thinks he has a better idea of what's good for people than people do is a swine. - P.J. O'Rourke -
I have made a window in Win32. I would like to somehow handle the minimize event, so I can do stuff when the user clicks the minimize button. Does anyone have any clue how to do this? Any help is appreciated. -Dev578