Results 1 to 3 of 3

Thread: my own summer!

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 1999
    Location
    chicago (hope)
    Posts
    146

    Wink

    how to make the mouse, do a click within code????????????????????????????????????

  2. #2
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    Code:
    'Before you start this program, I suggest you save everything that wasn't saved yet.
    Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
    Const MOUSEEVENTF_LEFTDOWN = &H2
    Const MOUSEEVENTF_LEFTUP = &H4
    Const MOUSEEVENTF_MIDDLEDOWN = &H20
    Const MOUSEEVENTF_MIDDLEUP = &H40
    Const MOUSEEVENTF_MOVE = &H1
    Const MOUSEEVENTF_ABSOLUTE = &H8000
    Const MOUSEEVENTF_RIGHTDOWN = &H8
    Const MOUSEEVENTF_RIGHTUP = &H10
    Private Sub Form_Activate()
        Do
            'Simulate a mouseclick on the cursor's position
            mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0&, 0&, cButt, dwEI
            DoEvents
        Loop
    End Sub
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  3. #3
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Code:
    'Force a mouse click by code 
    
    Private Declare Function PostMessage Lib _ 
    "user32" Alias "PostMessageA" (ByVal hwnd As Long, _ 
    ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) _ 
    As Long 
    
    Private Const WM_LBUTTONDOWN = &H201 
    Private Const WM_LBUTTONUP = &H202 
    Private Const MK_LBUTTON = &H1 
    
    Private Sub Command1_Click() 
    'click the Form 
    PostMessage Me.hwnd, WM_LBUTTONDOWN, MK_LBUTTON, 0 
    PostMessage Me.hwnd, WM_LBUTTONUP, MK_LBUTTON, 0 
    End Sub
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

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