|
-
May 16th, 2005, 03:37 PM
#1
Thread Starter
Frenzied Member
Press Start Button (No Windows Key Needed!)
I'm shure I have seen a few people ask for this before on other forums so, O thought I would post this here.
Description: Its a make-shift design to push the Start button:
Creator: Ryan Jones (Sciguyryan, Me)
code:
VB Code:
Private Declare Sub keybd_event Lib "user32.dll" ( _
ByVal bVk As Byte, _
ByVal bScan As Byte, _
ByVal dwFlags As Long, _
ByVal dwExtraInfo As Long)
Public Const KEYEVENTF_KEYUP = &H2
Public Const VK_LWIN = &H5B
And then as the call do the following:
VB Code:
keybd_event VK_LWIN, 0, 0, 0
keybd_event VK_LWIN, 0, KEYEVENTF_KEYUP, 0
Cheers and hope that helps someone, simple I know... 
Cheers,
RyanJ
-
Jun 26th, 2005, 11:23 AM
#2
New Member
Re: Press Start Button (No Windows Key Needed!)
 Originally Posted by sciguyryan
<snip...>
VB Code:
keybd_event VK_LWIN, 0, 0, 0
keybd_event VK_LWIN, 0, KEYEVENTF_KEYUP, 0
Cheers and hope that helps someone, simple I know...
Cheers,
RyanJ
Thanks Ryan, this certainly helped me. I was having a hard time figuring out how to press the Start button programatically and this code did the job. Thank you!
-
Aug 2nd, 2005, 09:08 PM
#3
Member
Re: Press Start Button (No Windows Key Needed!)
Another thing... how can I show the start menu in a certain screen position (not the default).
How can I show Start Menu at position X:700 and Y:500 for example.
Is there a way to do so?
Hope to have an answer.
Thanks.
Andy
-
Aug 2nd, 2005, 09:48 PM
#4
Re: Press Start Button (No Windows Key Needed!)
You have to use setwindowpos with the hwnd and the coordinates youd like : )
-
Aug 2nd, 2005, 09:52 PM
#5
Member
Re: Press Start Button (No Windows Key Needed!)
And how to retrieve the hwnd of the Start Menu? :P
-
Aug 3rd, 2005, 08:45 AM
#6
Re: Press Start Button (No Windows Key Needed!)
To get the hWnd of the start menu (In XP anyway)
VB Code:
Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String _
) As Long
' ---------
Dim hWndStartMenu As Long
hWndStartMenu = FindWindow("DV2ControlHost", "Start Menu")
Set its position (theoretically):
VB Code:
Declare Function SetWindowPos Lib "user32" ( _
ByVal hWnd As Long, _
ByVal hWndInsertAfter As Long, _
ByVal x As Long, _
ByVal y As Long, _
ByVal cx As Long, _
ByVal cy As Long, _
ByVal wFlags As Long _
) As Long
Const HWND_TOPMOST = -1
Const SWP_NOSIZE = &H1
Const SWP_NOMOVE = &H2
' ----------
SetWindowPos hWndStartMenu, HWND_TOPMOST, [hl=#ff3333]700[/hl], [hl=#33ff33]500[/hl], 0, 0, SWP_NOSIZE
That's what you should do, but I couldn't get it to work.
Last edited by penagate; Aug 3rd, 2005 at 09:02 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|