Re: how to catch Form Minimize event ?

cpp Russia
  • 14 years ago

    Hi friends!

    I write both vc++ SDI and MDI application. In dialog based i write my code OnSysCommand() as :

    void CDlgBaseDlg::OnSysCommand(UINT nID, LPARAM lParam)

    if ((nID & 0xFFF0) == IDM_ABOUTBOX)
         CAboutDlg dlgAbout;
     else if((nID & 0xFFF0) == 61472) //AFX_IDS_SCMINIMIZE
         //my Msg here when window is minized  

         CDialog::OnSysCommand(nID, lParam);

    If i use OnSize(), when i click trayicon, my program is just activated and not showed. I don't know why. That's why i use OnSysCommand(). But it doesn't work in SDI and MDI application. PLs advice me what i should do.

    Thanks in advance!


  • 14 years ago

    Hi michael

    First where is your ShowWindow(SW_NORMAL).

    Second most of the system tray programs hide their main window instead of minimizing it. so you have to use OnSize()

    That's why OnSize did'nt work in your code because you have used minimize option

    Check this Article with code explanation (how to use OnSize) or click here to download the Source code




Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“C++: an octopus made by nailing extra legs onto a dog.” - Steve Taylor