Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 871
  • Last Modified:

Catching WM_SIZE from a CDialog window

I'm having an odd problem...I am trying to detect when my CDialog window gets minimized. I tried handling WM_SIZE with  OnSize, and testing for the SIZE_MINIMIZE flag. However, when I minimize the window (both with the system menu on the window tool bar and the "minimize all windows" on the taskbar)the WM_SIZE message isn't even caught. Any ideas on how I can reliably tell when my window gets minimized? Thanks in advance...

0
salmalux
Asked:
salmalux
  • 2
  • 2
  • 2
  • +4
1 Solution
 
VAM345Commented:
Is a Dialog based application are`n?
0
 
VAM345Commented:
Is a Dialog based application are`n?
0
 
salmaluxAuthor Commented:
Hmm...not sure what that comment means =). The application is an SDI...I'm hiding the main frame window and want to catch when the dialog box I display is minimized.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
snoeglerCommented:
Try to catch the message within PreTranslateMessage(). MFC eats some messages,
i don't know why.
As i've had several problems with this myself, i've tried many ways to understand why and
when MFC catches messages away - but i didn't get it. If you subclass the Dialog using
SetWindowLong(....,DWL_DLGPROC, MyDlgProc), you get all messages - but i think
this isn't the way to go. Most of the messages reach PreTranslateMessage(); so you should
be able to catch them there.
0
 
schmidCommented:
Handling WM_SIZE with OnSize should work if you use it in the class CMainFrame.
0
 
BridgeCommented:
WM_WINDOWPOSCHANGED
0
 
BridgeCommented:
WM_WINDOWPOSCHANGED
0
 
Answers2000Commented:
Are you catching WM_SIZE in the right place

In CDialog derived class, and NOT in MainFrame


BTW a nice function you can use after the fact is IsIconic
0
 
FargoCommented:
It's obvious that the message WM_SIZE is NOT sent when you minimize a window no matter if it is a frame window, or a dialog. Another message - WM_SYSCOMMAND is fired instead. All you have to do is handle this message in a handle function which looks like that:

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

.and then check if the nID parameter is equal to SC_MINIMIZE.

Take a look at the help provided for the function CWnd::OnSysCommand

I hope, I was help :)

0
 
salmaluxAuthor Commented:
Thanks...I eventually just checked the window size in my existing OnMove function...but thanks anyway
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
  • 2
  • +4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now