Results 1 to 6 of 6

Thread: Press Start Button (No Windows Key Needed!)

  1. #1

    Thread Starter
    Frenzied Member sciguyryan's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,763

    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:
    1. Private Declare Sub keybd_event Lib "user32.dll" ( _
    2.     ByVal bVk As Byte, _
    3.     ByVal bScan As Byte, _
    4.     ByVal dwFlags As Long, _
    5.     ByVal dwExtraInfo As Long)
    6. Public Const KEYEVENTF_KEYUP = &H2
    7. Public Const VK_LWIN = &H5B

    And then as the call do the following:

    VB Code:
    1. keybd_event VK_LWIN, 0, 0, 0
    2. keybd_event VK_LWIN, 0, KEYEVENTF_KEYUP, 0

    Cheers and hope that helps someone, simple I know...

    Cheers,

    RyanJ
    My Blog.

    Ryan Jones.

  2. #2
    New Member
    Join Date
    Jun 2005
    Posts
    15

    Re: Press Start Button (No Windows Key Needed!)

    Quote Originally Posted by sciguyryan
    <snip...>

    VB Code:
    1. keybd_event VK_LWIN, 0, 0, 0
    2. 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!

  3. #3
    Member
    Join Date
    Aug 2003
    Posts
    63

    Exclamation 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

  4. #4
    Admodistrator |2eM!x's Avatar
    Join Date
    Jan 2005
    Posts
    3,900

    Re: Press Start Button (No Windows Key Needed!)

    You have to use setwindowpos with the hwnd and the coordinates youd like : )

  5. #5
    Member
    Join Date
    Aug 2003
    Posts
    63

    Re: Press Start Button (No Windows Key Needed!)

    And how to retrieve the hwnd of the Start Menu? :P

  6. #6
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Press Start Button (No Windows Key Needed!)

    To get the hWnd of the start menu (In XP anyway)

    VB Code:
    1. Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _
    2.     ByVal lpClassName As String, _
    3.     ByVal lpWindowName As String _
    4. ) As Long
    5.  
    6. ' ---------
    7.  
    8. Dim hWndStartMenu As Long
    9. hWndStartMenu = FindWindow("DV2ControlHost", "Start Menu")

    Set its position (theoretically):
    VB Code:
    1. Declare Function SetWindowPos Lib "user32" ( _
    2.     ByVal hWnd As Long, _
    3.     ByVal hWndInsertAfter As Long, _
    4.     ByVal x As Long, _
    5.     ByVal y As Long, _
    6.     ByVal cx As Long, _
    7.     ByVal cy As Long, _
    8.     ByVal wFlags As Long _
    9. ) As Long
    10.  
    11. Const HWND_TOPMOST = -1
    12. Const SWP_NOSIZE = &H1
    13. Const SWP_NOMOVE = &H2
    14.  
    15. ' ----------
    16.  
    17. 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
  •  



Click Here to Expand Forum to Full Width