Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Handling Minimize event

Handling Minimize event

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dev578
    wrote on last edited by
    #1

    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

    G J N 3 Replies Last reply
    0
    • D Dev578

      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

      G Offline
      G Offline
      Garth J Lancaster
      wrote on last edited by
      #2

      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'

      1 Reply Last reply
      0
      • D Dev578

        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

        J Offline
        J Offline
        Joe Woodbury
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • D Dev578

          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

          N Offline
          N Offline
          nguyenvhn
          wrote on last edited by
          #4

          And another way is to handle WM_NCLBUTTONDOWN or WM_NCLBUTTONUP messages and check wParam parameter for HTMINBUTTON value. You should read in MSDN for more information:).

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups