| |
|
|
| Subclassing - animated Window of Andreas Miethe: CompileMarkSeparation#####################################
animierte Fenster
und
Fenster-Eigenschaften ( Properties )
XProfan
ab Windows 98 und W2K
#####################################
Andreas Miethe * Juni 2004
#####################################
SET(FastMode,1)
$H windows.ph
$H messages.ph
Declare OldWindowProc&,BackBrush&
Declare Ende&,Button1&,Button2&
Proc ButtonCallback
Parameters Wnd&, Msg&, wParam&, lParam&
IF Msg& = ~WM_LBUTTONDOWN
SetText Wnd&,Autsch
Endif
IF Msg& = ~WM_LBUTTONUP
SetText Wnd&,Klick
Endif
Return ~CallWindowProc(~GetProp(Wnd&,OldCallback),Wnd&, Msg&, WParam&, LParam&)
EndProc
Proc WindowCallback
Parameters Wnd&, Msg&, wParam&, lParam&
If Msg& = ~WM_COMMAND
If lParam& = Button1&
If ~IsWindowVisible(Button2&) = 0
~SetWindowPos(Button2&,0,10,40,80,24,~SWP_HIDEWINDOW)
~AnimateWindow(Button2&,400,~AW_ACTIVATE | ~AW_SLIDE | ~AW_HOR_POSITIVE)
Endif
Endif
If lParam& = Button2&
SendMessage(Wnd&,~WM_CLOSE,0,0)
Endif
Endif
If Msg& = ~WM_CLOSE
~RemoveProp(Button2&,OldCallback)
~AnimateWindow(Wnd&,400,~AW_HIDE | ~AW_SLIDE | ~AW_VER_NEGATIVE)
~DeleteObject(Backbrush&)
~PostQuitMessage(0)Programm-Ende
Endif
Return ~CallWindowProc(OldWindowProc&,Wnd&, Msg&, WParam&, LParam&)
EndProc
WindowStyle 31
Window %Maxx+1,0 - 640,480
CLS ~GetSysColor(~COLOR_BTNFACE)
BackBrush& = ~CreateSolidBrush(~GetSysColor(~COLOR_BTNFACE))
~SetClassLong(%hwnd,~GCL_HBRBACKGROUND,BackBrush&)
OldWindowProc&= ~SetWindowLong(%hwnd,~GWL_WNDPROC, ProcAddr(WindowCallback,4))
SetDialogFont ~GetStockObject(~DEFAULT_GUI_FONT)
Button1& = Create(BUTTON,%hwnd,Klick,10,10,80,24)
Eigenschaft OldCallback setzen ( in diesem Fall wird das alte Callback gesichert )
das spart eine globale Variable
~SetProp(Button1&,OldCallback,~SetWindowLong(Button1&,~GWL_WNDPROC, ProcAddr(ButtonCallback,4)))
Button2& = Create(BUTTON,%hwnd,Ende,0,0,0,0)
ShowWindow(Button2&,0)
~SetWindowPos(%hwnd,0,0,0,640,480,~SWP_SHOWWINDOW)
Whilenot Ende&
put
EndWhile
salvo, iF. |
|
|
| |
|
|