|  |  | 
|  | 
|  | 
|  | | Beispiel zum Erzeugen von Hover -Effekten ohne die Postion der Controls zu kennen via Handle mit der API Funktion TrackMouseEvent (Funktioniert erst ab Windows 98)
 KompilierenMarkierenSeparieren
 Beispiel für einen Hover Effekt ohne Positionsangaben der Controls
mit der Api Funktion TrackMouseEvent
Autor: Dieter Zornow
Code zur freien Verwendung
Xprofan, für 6.6 und kleiner bitte die bezeichneten Befehle umändern
getestet unter ME und XP prof.
Dieses Funktion arbeitet erst ab Windows 98
Proc showold
    SetWindowPos button1& = 20,420-70,30;0
    SetWindowPos button2& = 140,420,70,30;0
    SetWindowPos Edit1& = 300,15,110,22;0
    SetWindowPos listbox1& = 0010,0015,0130,0100;0
endproc
Def TrackMouseEvent(1) ! "user32","TrackMouseEvent"
Def ChildWindowFromPoint(3) ! "user32","ChildWindowFromPoint" 3 Parameter, entgegen der Anzahl in der Win32.help
Def GetCursorPos(1) ! "USER32","GetCursorPos"
Def ScreenToClient(2) ! "USER32","ScreenToClient"
DEF GETSYSCOLOR(1) !"USER32","GetSysColor"
DECLARE BUTTON1&
DECLARE BUTTON2&
DECLARE LISTBOX1&
DECLARE EDIT1&
DECLARE ENDE%,point#,hover#,child&
WINDOWSTYLE 31+512
WINDOWTITLE "TrackMouseEvent"
WINDOW SUB(DIV(%MAXX,2),DIV(640,2)),SUB(DIV(%MAXY,2),DIV(500,2))-640,500
SETTRUECOLOR 1
CLS GETSYSCOLOR(15)
USEFONT "MS Sans Serif",13,0,0,0,0
SETDIALOGFONT 1
dim point#,8
dim hover#,16
long hover#,0 = 16
long hover#,4 = 3
long hover#,8 = getactivewindow()
long hover#,12 = 3
bei hover#,12 ist der Standardwert 400 ms, was auch im Interpreter funktioniert
als Exe läuft es bei mir erst ab 5 ms und weniger
BUTTON1& = CREATE("BUTTON",%HWND,"Nichts",0020,0420,0070,0030)
BUTTON2& = CREATE("BUTTON",%HWND,"Ende",0140,0420,0070,0030)
LISTBOX1& = CREATE("LISTBOX",%HWND,"LISTBOX",0010,0015,0130,0100)
EDIT1& = CREATE("EDIT",%HWND,"Während Eingabe muss Mauszeiger über dem Edit stehen oder dann auf focus wechseln",0300,0015,0110,0022)
usermessages 16 nur Profan > 6.6
whileloop 30 nur Profan > 6.6
    addstring(listbox1&,"Eintrag"+str$(&loop))
endwhile
Locate 30,1
Print "Bitte mal mit der Maus über die Controls fahren"
WHILENOT ENDE%
    getmessage
    If %Umessage = 16 nur Profan > 6.6
        LET ENDE%= 1
    endif
    IF GETFOCUS(BUTTON1&) BUTTON
    ELSEIF GETFOCUS(BUTTON2&) BUTTON
        if %lastmessage = 514
            LET ENDE%= 1
        endif
    ELSEIF GETFOCUS(LISTBOX1&) LISTBOX
    ELSEIF GETFOCUS(EDIT1&) EDIT
    ENDIF
    GetCursorPos(point#)
    ScreenToClient(%hwnd,point#)
    child& = ChildWindowFromPoint(%hwnd,@long(point#,0),@long(point#,4))
    TrackMouseEvent(hover#)
    if %message = 675
        case child& = BUTTON1&:SetWindowPos button1& = 18,418-72,32;0
        case child& = BUTTON2&:SetWindowPos button2& = 138,418,72,32;0
        case child& = edit1&:SetWindowPos Edit1& = 200,15,300,22;0
        case child& = listbox1&:SetWindowPos listbox1& = 10,15,130,400;0
    endif
    if %message = 673
        showold
    endif
WEND
dispose point#
dispose hover#
end
 | 
 | 
|  | 
|  |  | 
|  | 
| 
 
 
 |