VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



'Get the caption of control which captures mouse event using GetCapture API

by Karthikeyan (187 Submissions)
Category: Windows API Call/Explanation
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Tue 23rd January 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

'Get the caption of control which captures mouse event using GetCapture API

API Declarations


Private Declare Function GetWindowText Lib "user32.dll" Alias "GetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String, ByVal length As Long) As Long
Private Declare Function GetWindowTextLength Lib "user32.dll" Alias "GetWindowTextLengthA" (ByVal hWnd As Long) As Long

Rate 'Get the caption of control which captures mouse event using GetCapture API



'Visit my Homepage at
'http://www.geocities.com/marskarthik
'http://marskarthik.virtualave.net
'Email: [email protected]
Private Sub Form_Load()
Timer1.Enabled = True
Timer1.Interval = 5
End Sub
Private Sub Timer1_Timer()
Dim hWnd As Long
Dim wntxt As String
Dim length As Long
hWnd = GetCapture()
If hWnd Then
length = GetWindowTextLength(hWnd) + 1
wntxt = Space(length)
length = GetWindowText(hWnd, wntxt, length)
wntxt = Left(wntxt, length)
Label1.Caption = wntxt & " has captured the mouse"
End If
End Sub

Download this snippet    Add to My Saved Code

'Get the caption of control which captures mouse event using GetCapture API Comments

No comments have been posted about 'Get the caption of control which captures mouse event using GetCapture API. Why not be the first to post a comment about 'Get the caption of control which captures mouse event using GetCapture API.

Post your comment

Subject:
Message:
0/1000 characters