Geht aber auch ohne subclassing
Code
Def TrackMouseEvent(1) ! "user32","TrackMouseEvent"
Def ChildWindowFromPoint(3) ! "user32","ChildWindowFromPoint"
Def GetCursorPos(1) ! "USER32","GetCursorPos"
Def ScreenToClient(2) ! "USER32","ScreenToClient"
'Def ReleaseCapture(0) ! "USER32","ReleaseCapture"
'Def SetCapture(1) ! "USER32","SetCapture"
DEF GETSYSCOLOR(1) !"USER32","GetSysColor"
DECLARE BUTTON1&,ENDE%,point#,hover#,child&
WINDOWSTYLE 31
WINDOWTITLE "Neues Fenster"
WINDOW ((%MAXX/2)-(640/2)),((%MAXY/2)-(500/2))-640,500
Set("TrueColor",1)
CLS GETSYSCOLOR(15)
USEFONT "MS Sans Serif",13,0,0,0,0
SETDIALOGFONT 1
BUTTON1& = CREATE("BUTTON",%HWND,"BUTTON",0278,0219,0070,0030)
SETFOCUS(%HWND)
usermessages 16
dim point#,8
dim hover#,16
long hover#,0 = 16
long hover#,4 = 3
long hover#,8 = getactivewindow()
long hover#,12 = 3
WHILENOT ENDE%
getmessage
If %Umessage = 16
ENDE%= 1
endif
IF GETFOCUS(BUTTON1&)'BUTTON
if %lastmessage = 512
Usecursor 5
Set("ErrorLevel", -1)
case long(point#,0) < 0:long point#,0 = 0
case long(point#,4) < 0:long point#,4 = 0
SetWindowPos BUTTON1& = long(point#,0),long(point#,4),0070,0030;0
WINDOWTITLE str$(long(point#,0))+" - "+str$(long(point#,4))
endif
if %lastmessage = 514
Usecursor 0
setfocus(%Hwnd)
Set("ErrorLevel", 0)
endif
ENDIF
GetCursorPos(point#)
ScreenToClient(%hwnd,point#)
child& = ChildWindowFromPoint(%hwnd,long(point#,0),long(point#,4))
TrackMouseEvent(hover#)
endwhile
dispose point#
dispose hover#
end
Alles anzeigen