How to determine when the Windows 7 start menu opens

I wrote a WPF application in C # that I would like to show every time the start menu opens and hides again when the menu is closed. I would prefer to do this without polling the status of the Start menu. So far I have tried to listen to SHELLHOOK messages, but I do not see anything useful there.

+6
source share
1 answer

I can’t write the full code, but here is the logic of it,

  • First find the taskbar handle using

    [DllImport("user32.dll", SetLastError = true)] public static extern IntPtr FindWindow(string lpClassName, string lpWindowName); 

    also passes Shell_TrayWnd as lpClassName

  • Activate the Start menu by simulating a click button.

  • Get the handle to the start menu window

  • Use the GetWindowLong function to verify that it is open or not.

+2
source

Source: https://habr.com/ru/post/918563/


All Articles