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!

Have u try ?

If GetAsyncKeyState(VK_LBUTTON ) Then
    If GetAsyncKeyState(VK_RBUTTON ) = 0 Then
..
    End If
End If

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

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

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

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

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..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.