|
Post by Roger Cabo on Oct 13, 2022 10:09:12 GMT 1
Hi everyone, is it possible to get the OCX.Hwnd under the mouse pointer (while running with F5) with any system function, no matter what form is active? I like to create new mouse over effect for labels that are created by an array OCXOCX frm label(N).
Thanks a lot!
|
|
|
Post by dragonjim on Oct 13, 2022 21:47:24 GMT 1
Here's a short bit of code that does what I think you want to do.
OpenW 1 Ocx Frame f1 = "Frame", 200, 200, 200, 200 OcxOcx f1 Label lbl(1) = "Label 1", 10, 10, 150, 15 OcxOcx f1 Label lbl(2) = "Label 2", 10, 40, 150, 15 OcxOcx f1 Label lbl(3) = "Label 3", 10, 70, 150, 15 OcxOcx f1 TextBox txt(1) = "", 10, 100, 150, 15 OcxOcx f1 TextBox txt(2) = "", 10, 130, 150, 15 Do : Sleep : Until IsNothing(Win_1)
Sub f1_MouseMove(Button&, Shift&, x!, y!) txt(1).Text = "" txt(2).Text = "" EndSub Sub lbl_MouseMove(Index%, Button&, Shift&, x!, y!) txt(1).Text = "Label " & Trim(Index%) txt(2).Text = lbl(Index%).hWnd EndSub
The f1_MouseMove is included to signify when the mouse has left the last label
|
|
|
Post by Roger Cabo on Oct 20, 2022 14:54:30 GMT 1
Thank you. I found another approach to get the hwnd under the mouse cursor.
This is much more efficient to create mouse over effect on really any control than my older version with MessageProc() Anyway it requires a global list of controls use the mouse over effect and a separate pooling.
hWnd = WindowFromPoint(MouseSX, MouseSY)
|
|