6

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.

Hemlock
  • 6,130
  • 1
  • 27
  • 37
  • 1
    I'm not sure that application will get a lot of user appreciation! :) – James World Jun 20 '12 at 13:22
  • 2
    I'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
  • 2
    Instead 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 Answers1

2

I Can't write you full code but here is the logic behind it,

  1. 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 lpClassName

  2. Activate the Start Menu by simulating click button.

  3. Get the window handle of Start Menu

  4. Use GetWindowLong function to check it is open or not.

saluce
  • 13,035
  • 3
  • 50
  • 67
Rajesh Subramanian
  • 6,400
  • 5
  • 29
  • 42