Article View: be.comp.programming
Article #9175VB6 : WindowFromPoint voor labels?
From: BOBJE
Date: Wed, 15 May 2002 07:32
Date: Wed, 15 May 2002 07:32
38 lines
2594 bytes
2594 bytes
Hallo,
Ik gebruik onderstaande code voor het weergeven van de waarden van de
control waar op dat moment de muispointer op staat.
Dit werkt voor alle controls die op de form staan behalve voor Labels. Hoe
kan ik de code zodanig aanpassen dat de caption van de labels ook getoond
worden. (Als dit al mogelijk is)
Het venster dat moet 'onderzocht' worden is een ander programma dan de
mijne.
Dank u
Private Sub Timer1_Timer()
Dim mousepos As POINT_TYPE ' coordinates of the mouse cursor
Dim wintext As String, slength As Long ' receive title bar text and its
length
Dim hWnd As Long ' handle to the window found at the point
Dim retval As Long ' return value
' Determine the window the mouse cursor is over.
retval = GetCursorPos(mousepos) ' get the location of the mouse
hWnd = WindowFromPoint(mousepos.x, mousepos.y) ' determine the window
that's there
If hWnd = 0 Then ' error or no window at that point
Debug.Print "No window exists at that location."
End
End If
' Display that window's title bar text
slength = GetWindowTextLength(hWnd) ' get length of title bar text
wintext = Space(slength + 1) ' make room in the buffer to receive the
string
slength = GetWindowText(hWnd, wintext, slength + 1) ' get the text
wintext = Left(wintext, slength) ' extract the returned string from the
buffer
lblCurrentControl = wintext
End Sub
Technical Details
Message-ID:
<0aoE8.11$fh6.402@nreader1.kpnqwest.net>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!supernews.com!nntp.cs.ubc.ca!fu-berlin.de!newsfeed.vmunix.org!newsfeed.belnet.be!news.belnet.be!borium.box.nl!newsfeed.wxs.nl!news2.kpn.net!news.kpn.net!nslave.kpnqwest.net!nloc2.kpnqwest.net!nloc.kpnqwest.net!nmaster.kpnqwest.net!nreader1.kpnqwest.net.POSTED!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: DUTCH,ASCII-7-bit X-Google-Thread: fcea4,f658441c63bc0efc,start X-Google-Attributes: gidfcea4,public X-Google-ArrivalTime: 2002-05-15 00:32:43 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!supernews.com!nntp.cs.ubc.ca!fu-berlin.de!newsfeed.vmunix.org!newsfeed.belnet.be!news.belnet.be!borium.box.nl!newsfeed.wxs.nl!news2.kpn.net!news.kpn.net!nslave.kpnqwest.net!nloc2.kpnqwest.net!nloc.kpnqwest.net!nmaster.kpnqwest.net!nreader1.kpnqwest.net.POSTED!not-for-mail From: "BOBJE" <bobje80@hotmail.com> Newsgroups: be.comp.programming Subject: VB6 : WindowFromPoint voor labels? Lines: 40 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Message-ID: <0aoE8.11$fh6.402@nreader1.kpnqwest.net> Date: Wed, 15 May 2002 07:32:12 GMT NNTP-Posting-Host: 213.49.37.3 X-Complaints-To: abuse@kpn.be X-Trace: nreader1.kpnqwest.net 1021447932 213.49.37.3 (Wed, 15 May 2002 09:32:12 MET DST) NNTP-Posting-Date: Wed, 15 May 2002 09:32:12 MET DST Organization: KPNQwest customer news service