Results 1 to 8 of 8

Thread: keybd_event Left Mouse Button Constant?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2006
    Posts
    172

    keybd_event Left Mouse Button Constant?

    What is the keybd constand for the left mouse button?
    All the documentation I have been able to find says its 0x01 wich should be &H1 right? Yet, it dosen't seem correct.

    And while im at it:
    I have a multi button mouse (4 normal buttons and then a scroll weel that has 3 more in it). What are the keybd constants for those?

    Code:
    Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, _
        ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
    Private Const MYKEYEVENTF_KEYUP = &H2
    
    Private Const MYVK_LBUTTON = &H1
    ''''''''''''''''''''''''''''''''''''''''''''''
    
                        keybd_event MYVK_LBUTTON, 0, 0, 0
                        Sleep 500
                        keybd_event MYVK_LBUTTON, 0, MYKEYEVENTF_KEYUP, 0
    (yes, I have looked around quite a bit. Seems one of the hardest things for me to find a 100% complete and correct source on....)

  2. #2
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: keybd_event Left Mouse Button Constant?

    tonto
    is this page did not help ?
    http://msdn.microsoft.com/en-us/libr...40(VS.85).aspx

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Oct 2006
    Posts
    172

    Re: keybd_event Left Mouse Button Constant?

    That is the page I've been useing
    VK_LBUTTON (0x01)
    Left mouse button
    Private Const MYVK_LBUTTON = &H1 Dosent seem to be correct.

  4. #4
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: keybd_event Left Mouse Button Constant?

    You should use the mouse_event function instead of the keybd_event function for mouse handling routines.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Oct 2006
    Posts
    172

    Re: keybd_event Left Mouse Button Constant?

    Got a link?

  6. #6
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: keybd_event Left Mouse Button Constant?

    Quote Originally Posted by Tontow
    Got a link?
    Yes I have, since I know how to do a Google search
    http://allapi.mentalis.org/apilist/mouse_event.shtml

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Oct 2006
    Posts
    172

    Re: keybd_event Left Mouse Button Constant?

    Is it better to use mouse_event or SetCursorPos to move the mouse?

    Code:
    Private Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long

  8. #8
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: keybd_event Left Mouse Button Constant?

    It doesn't really matter. If all you want to do is to move te cursor then using SetCursorPos is a bit easier to call. However mouse_event can do so much more.

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