Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21271

Rebuilding mouse event using sendmessage, wrong hwnd 0x00000001...

$
0
0
Hello,

Attachment 94299

With the code below, I try to rebuild the mouse events as shown in red in the image.
But the result, in blue, is achieved with the wrong hwnd (0x00000001 instead of &h00010954).

' --- START ----

Private Const WM_MOUSEMOVE As Long = &H200
Private Const WM_SETCURSOR = &H20
Private Const WM_NCHITTEST = &H84

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long


Function MakeDWord(ByVal LoWord As Integer, ByVal HiWord As Integer) As Long
MakeDWord = (HiWord * &H10000) Or (LoWord And &HFFFF&)
End Function



Dim DaWord As Long
Dim x As Long
Dim y As Long
x = 6
y = 34

DaWord = MakeDWord(x, y)

' ------------------
' the Text1.Text has a value of &h00010954
' ------------------

SendMessage Text1.Text, WM_NCHITTEST, 1&, ByVal DaWord
Debug.Print Time & " SendMessage " & Text1.Text & " " & "WM_NCHITTEST, 1&, ByVal " & DaWord

SendMessage Text1.Text, WM_SETCURSOR, 1&, ByVal DaWord
Debug.Print Time & " SendMessage " & Text1.Text & " " & "WM_SETCURSOR, 1&, ByVal " & DaWord

SendMessage Text1.Text, WM_MOUSEMOVE, 1&, ByVal DaWord
Debug.Print Time & " SendMessage " & Text1.Text & " " & "WM_MOUSEMOVE, 1&, ByVal " & DaWord

' --- END ----

Here is the debug info:
8:38:59 AM SendMessage &h00010954 WM_NCHITTEST, 1&, ByVal 2228230
8:38:59 AM SendMessage &h00010954 WM_SETCURSOR, 1&, ByVal 2228230
8:38:59 AM SendMessage &h00010954 WM_MOUSEMOVE, 1&, ByVal 2228230


Could somebody please tell me what's wrong with my code, and how to fix it?
Thank you.
Attached Images
 

Viewing all articles
Browse latest Browse all 21271

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>