0

well, basicly i just want to detect when the left mouse button goes from being DOWN (clicked) to UP(unclicked). and this will be hapening externaly, like, i may be clicking Freecell, not the VB form. I alredy have some code

Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer
Private Const VK_LBUTTON = &H1
Private Const VK_RBUTTON = &H2


If GetAsyncKeyState(VK_LBUTTON ) Then

but thse only detect left/right clicks, the down event, not the up

Thanks!

5
Contributors
7
Replies
8
Views
7 Years
Discussion Span
Last Post by selvaganapathy
0

Hi friend try this code.
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
Form1.BackColor = RGB(111, 222, 225)
Else
Form1.BackColor = &H8000000F
End If
End Sub

Private Sub Timer1_Timer()
Form1.BackColor = &H8000000F
MsgBox "You released the left button"
End Sub

0

those all work to detect if the left buton has been pushed down, not the relese of it though. i've searched for days to no avail. so it may be imposible. thaks for helping though

Edited by crackerjacker: n/a

0
choose the MouseUp event

Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
MsgBox "Hello World"
End Sub
0

yes, but with that it is restricted to detecting mouse activity within the form, i want to detect mouse activity in general, like Freecell may be selected. not the vb form. Thanks though

0

If u want to receive the event even if ur application is not in focus, You may try the Hooking Concept (Mouse Hooking, Keyboard Hooking) .... But it is dangerous, if u r not careful. It can crash ur application..

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.