I have written a WPF application in C# which I would like to show every time the start menu is opened and hide again when the menu is closed. I would prefer to do this without polling the state of the start menu. So far I've tried listening to the SHELLHOOK messages but I'm not seeing anything useful there.
Asked
Active
Viewed 931 times
6
-
1I'm not sure that application will get a lot of user appreciation! :) – James World Jun 20 '12 at 13:22
-
2I'm the user, I'll appreciate it! I've been forced to use Windows and I'd rather be on Gnome-shell. – Hemlock Jun 20 '12 at 13:26
-
If you're the only user then why would it matter if code does poll or doesn't? – Dialecticus Jun 20 '12 at 14:22
-
I can't see how the number of users makes polling better. As far as I'm concerned, polling is always the last resort. – Hemlock Jun 20 '12 at 14:38
-
2Instead of focusing on a possible tech level solution, what are you trying to *accomplish*? – snemarch Jun 20 '12 at 15:28
-
@snemarch Have you used Gnome-Shell? It has a dashboard that encompasses both a launcher and an Exposé clone. What I have completed is an Exposé clone; I'd like it to open along with the start menu accomplishing something close to the Gnome-Shell dashboard. – Hemlock Jun 20 '12 at 15:34
-
Windows Key + Tab is close enough for me. You can click the window you want with the mouse as well. – James World Jun 20 '12 at 23:42
1 Answers
2
I Can't write you full code but here is the logic behind it,
First find the handle for the task bar using
[DllImport("user32.dll", SetLastError = true)] public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
also pass
Shell_TrayWnd
as lpClassNameActivate the Start Menu by simulating click button.
Get the window handle of Start Menu
Use
GetWindowLong
function to check it is open or not.

saluce
- 13,035
- 3
- 50
- 67

Rajesh Subramanian
- 6,400
- 5
- 29
- 42
-
1Yes, this will work _if I poll_. I'd rather not poll so I'll update my question. – Hemlock Jun 20 '12 at 14:08
-
how would you use GetWindowLong in order to check if the Start Menu is open or not? – Yoav Feuerstein Jun 28 '17 at 13:10