sharen
sharen

Reputation: 11

Event on Application Minimized in C++ Windows API

Is there a signal or event in the Windows Desktop API that can tell me if my application is in a minimized state? I looked through msdn documentation and have only found minimize events that call as the application is minimizing, not when the application is already done the minimize and in a final minimized state.

I need to set another operation off ( a screen capture) when I know the window that I set is minimized and out of the way of the screen capture. I use the WM_SIZE message to check the window is minimized, then start the screen capture. My problem is that I can still see the application window closing when the screen capture is taken (i.e. the minimization animation done by most application windows), even though I got a SIZE_MINIMIZED message through a ProcessWindowMessage callback. I need something to tell me that the application is fully minimized, and not in the way of the screen capture I am taking of the entire desktop.

Thanks!

Upvotes: 1

Views: 2840

Answers (3)

kvr
kvr

Reputation: 573

You can try the solution mentioned here: How could I detect when my application is minimized?

~snip:

switch (message)
{
case WM_SYSCOMMAND:
    if ((wParam & 0xFFF0) == SC_MINIMIZE)
    {
        // shrink the application to the notification area
        // ...

        return 0;
    }
    break;
}

Or try the GetWindowPlacement function: https://msdn.microsoft.com/en-us/library/windows/desktop/ms633518(v=vs.85).aspx

~snip

Retrieves the show state and the restored, minimized, and maximized positions of the specified window.

Upvotes: 0

shf301
shf301

Reputation: 31394

I believe you are looking for the WM_SIZE message. It will be sent after the window's size has changed. If you window was minimised the wParam variable should be equal to SIZE_MINIMIZED

Upvotes: 1

HerrJoebob
HerrJoebob

Reputation: 2313

You probably want IsIconic(); if your window is minimized that API will return non-zero.

Upvotes: 2

Related Questions