[win 10, c#] Interop - Way to recognize the right Normal vs Minimized application (normal app and UWP one) RRS feed

  • Question

  • Hello,

    In reference to the solution of this

    I need to be able to associate the right 'application hWnd' when minimized to the right hWnd when Maximized or Normal. The solution (this) propose is great but this if you start several, for instance, calculators then you do not know which one is minimize vs normal.

    For instance,

      1. if I start 3 calculators (add number 1, 2 and 3 to the respective 3 calulators)

      2. Then minimize them

      3. then run the app from the solution (this), you will see one of them pop-up

      4. Then put the 3 calc as normal (not minimized) and only put the one that did pop up as minimize and press the button again, you will see the one minimize won't become Normal.

    The basic issue is to find a way to recognize which hWnd (when minimize) represents the same window (with the normal hwnd)..right now it just consider the first one it find is the right one.

    Any idea?

    I could recognize with the size (thought that might even not work as the size have their top change to -32000 when minimized), but anyway those size could change and so it doesn't feel super robust, what is the right way to know exactly this hWndMinimize is equivalent to this other hWndNormalandMaximized for a UWP like Calc.


    • Edited by wil70 Saturday, April 14, 2018 12:01 AM
    Friday, April 13, 2018 2:41 PM

All replies

  • I can't quite grasp your exact requirements, but the IsIconic API can tell you if an application is currently minimized.  In the original versions of Windows (prior to Win 95), there was no task bar, and you didn't store icons on the desktop.  Instead, a minimized window was displayed as its icon.  Hence, "IsIconic".

    Tim Roberts, Driver MVP Providenza & Boekelheide, Inc.

    Friday, April 13, 2018 9:22 PM