Click here to Skip to main content
15,888,527 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All:
Is there any way to open windows start menu from c#?

For example: if I click some button then windows xp start menu become open.

Like when you click

start---all program

Thank you.
Posted
Updated 30-Jan-11 1:00am
v2

Use Spy++[^] to determine how to get the required windows handle and send a click event.

Regards
Espen Harlinn
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 30-Jan-11 23:34pm    
Pretty universal method for many cases - a 5. I don't think SendKeys might work but P/Invoke will resolve everything.
--SA
fjdiewornncalwe 23-Feb-11 22:22pm    
+5. This will work.
Espen Harlinn 24-Feb-11 16:24pm    
Thank you Marcus!
There are several ways to do what you want and if you had bothered to perform an internet search before asking here, you might have found this[^].

Please, next time, search first. Don't expect others to do your work for you.
 
Share this answer
 
Comments
Espen Harlinn 30-Jan-11 7:11am    
5+ That's even simpler, good solution :)
Abdullahomaid 30-Jan-11 7:16am    
i am searching since 2 hours in google, but i did not find any acceptable solution.any way thank you i also check that site which you have share. "thank u".
Henry Minute 30-Jan-11 7:19am    
Then you should say that you have searched, in your question, and also why what you found didn't suit your needs. Then people can suggest things that you haven't already rejected.
Abdullahomaid 30-Jan-11 7:34am    
ok and thank you.
Sergey Alexandrovich Kryukov 30-Jan-11 23:33pm    
Henry, sorry, as far as I can understand, it won't work, because SendKeys only works for active window. I'll be happy if you prove me wrong though.
--SA
Another, more direct and universal way of doing this is using P/Invoke with Windows API SendInput, http://msdn.microsoft.com/en-us/library/ms646310(v=vs.85).aspx[^].

This API simulate keyboard and mouse input on a very low level, as if the input even is fired from the hardware driver, which makes this way of even simulation universally applicable to any situation.

—SA
 
Share this answer
 
Comments
Anthony Mushrow 23-Feb-11 20:45pm    
I don't think SendInput works on that low a level. So far as I'm aware it can't fool DirectInput or other similar input libraries. It's not a problem in this case but maybe something to be aware of.
Sergey Alexandrovich Kryukov 23-Feb-11 21:15pm    
Thank you for the note.
Maybe, but what's the difference? What do you mean by fooling "DirectInput?"; what would be the example if it?
Thank you.
--SA
Anthony Mushrow 23-Feb-11 22:56pm    
DirectInput part of DirectX, allows exclusive access to input devices meaning that there isn't any (or at least very little) handling done by windows between the program using DirectInput and the hardware itself. Games use DirectInput to get user input from game controllers and keyboards, and they're mostly the only things that do.
Sergey Alexandrovich Kryukov 23-Feb-11 23:03pm    
I know; you did not answer my question. I wanted to understand what you meant by "fooling"?
--SA
Anthony Mushrow 23-Feb-11 23:52pm    
Sorry, I meant that for a program using DI to get input from the keyboard the SendInput API might not have any effect. The sent keypresses might not show up when the device is polled.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900