CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2000
    Posts
    45

    Detect shift+left mouse click

    how would I detect if any shift button and the left mouse button has been clicked anywhere on the desktop?


  2. #2
    Join Date
    Aug 1999
    Location
    US, Florida
    Posts
    817

    Re: Detect shift+left mouse click

    Here is the code to detect right, left mouse clicks and Shift

    private Declare Function GetAsyncKeyState Lib "user32" (byval vKey as Long) as Integer
    private Const VK_LBUTTON = &H1
    private Const VK_RBUTTON = &H2
    private Const VK_SHIFT = &H10


    private Sub Form_Load()
    Timer1.Interval = 100
    End Sub

    private Sub Timer1_Timer()
    If GetAsyncKeyState(VK_LBUTTON) then Caption = "left"
    If GetAsyncKeyState(VK_RBUTTON) then Caption = "right"
    If GetAsyncKeyState(VK_SHIFT) then Caption = "shift"
    End Sub



    Just paste it into clear form


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

Featured