Solved

handling "minimize all"

Posted on 2002-04-01
5
195 Views
Last Modified: 2013-11-20
Hi.
I know how to handle a "minimize" command...

void CMainFrame::OnSysCommand(UINT nID, LPARAM lParam) {
     if(nID==SC_MINIMIZE)

...but I do not know how to handle "minimize all"
ie: from the start bar, or by pressing Windows key + 'M'.

Does anybody know how to do this?

Thanks.
0
Comment
Question by:bwilhelm
  • 2
5 Comments
 
LVL 4

Expert Comment

by:pagladasu
ID: 6911210
Add these three lines of code:
keybd_event(VK_LWIN, 0, 0, 0);
keybd_event(77, 0, 0, 0);
keybd_event(VK_LWIN, 0, KEYEVENTF_KEYUP, 0);
0
 
LVL 31

Expert Comment

by:Zoppo
ID: 6912355
Hi bwilhelm,

generally the window which is being minimized (either with 'Minimize' or 'Minimize All')
recieves a WM_SIZE message with wParam == SIZE_MINIMIZED.

You can handle this message but I think that you can't distinguish how the window
is minimized.

hope that helps,

ZOPPO
0
 

Author Comment

by:bwilhelm
ID: 6913013
Thanks for the input so far.

The keybd_event() suggestion seems to synthesize
a minimize command, which is not what I'm looking for.

I do get the WM_SIZE/SIZE_MINIMIZED, but it is too late
to ignore the message.  Minimize is already being
performed.

I would like to trap the "minimize all" command and
ignore it, leaving the window displayed, like I can
do for normal "minimize" via the WM_SYSCOMMAND/SC_MINIMIZE
handling.

Thanks for any additional hints.
0
 
LVL 31

Accepted Solution

by:
Zoppo earned 300 total points
ID: 6917524
Hmm ... sorry, but I found no way to catch the MINIMIZE ALL command ... but,
to avoid that a window can be minimized at all it should be ok to create it
without the WS_MINIMIZEBOX style, i.e. with implementing a PreCreateWindow()
like this:

BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
 if( !CMDIFrameWnd::PreCreateWindow(cs) )
  return FALSE;
 cs.style &= ~WS_MINIMIZEBOX;
 return TRUE;
}

hope that helps,

ZOPPO
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

943 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

Need Help in Real-Time?

Connect with top rated Experts

4 Experts available now in Live!

Get 1:1 Help Now