?
Solved

Catching WM_SIZE from a CDialog window

Posted on 1998-09-30
10
Medium Priority
?
851 Views
Last Modified: 2013-11-20
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
Comment
Question by:salmalux
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +4
10 Comments
 
LVL 1

Expert Comment

by:VAM345
ID: 1322743
Is a Dialog based application are`n?
0
 
LVL 1

Expert Comment

by:VAM345
ID: 1322744
Is a Dialog based application are`n?
0
 

Author Comment

by:salmalux
ID: 1322745
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
Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

 
LVL 6

Expert Comment

by:snoegler
ID: 1322746
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
 

Expert Comment

by:schmid
ID: 1322747
Handling WM_SIZE with OnSize should work if you use it in the class CMainFrame.
0
 
LVL 1

Expert Comment

by:Bridge
ID: 1322748
WM_WINDOWPOSCHANGED
0
 
LVL 1

Expert Comment

by:Bridge
ID: 1322749
WM_WINDOWPOSCHANGED
0
 
LVL 8

Expert Comment

by:Answers2000
ID: 1322750
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
 
LVL 1

Accepted Solution

by:
Fargo earned 150 total points
ID: 1322751
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
 

Author Comment

by:salmalux
ID: 1322752
Thanks...I eventually just checked the window size in my existing OnMove function...but thanks anyway
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question