PDA

Click to See Complete Forum and Search --> : Press Start Button (No Windows Key Needed!)


sciguyryan
May 16th, 2005, 03:37 PM
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:


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:


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

jonecool
Jun 26th, 2005, 11:23 AM
<snip...>


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!

UnknownX
Aug 2nd, 2005, 09:08 PM
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

|2eM!x
Aug 2nd, 2005, 09:48 PM
You have to use setwindowpos with the hwnd and the coordinates youd like : )

UnknownX
Aug 2nd, 2005, 09:52 PM
And how to retrieve the hwnd of the Start Menu? :P

penagate
Aug 3rd, 2005, 08:45 AM
To get the hWnd of the start menu (In XP anyway)

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):
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, 700, 500, 0, 0, SWP_NOSIZE


That's what you should do, but I couldn't get it to work.