English
Source / code snippets

Animated Window

 

Andreas
Miethe


an small Spielerei with Windows
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
 
Gruss
Andreas
________ ________ ________ ________ _
Profan 3.3 - XProfanX2
Win 95,98,ME,2000,XP,Vista - Win 7 32 / 64 Bit
ASUS X93S - Intel Core I7-NVIDIA GForce 540M 8GB Arbeitsspeicher
Homepage :  [...] 
06/06/04  
 




p.specht

... for XProfan11.2a
'#####################################
'Animated Fensterelemente  and
'Window-properties ( Properties )
'XProfan ex windows 98 and W2k
'#####################################
'Andreas Miethe * june 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)'Program-end

    Endif

    Return ~CallWindowProc(OldWindowProc&,Wnd&, Msg&, WParam&, LParam&)

ENDPROC

Window Style 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)
'quality "OldCallback" settle ( in this drop becomes the "alte" Callback ensured )
'the saving a 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&

    waitinput

EndWhile


P.s.: can one whom Prettyfier somehow einbremsen?
 
Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'...
02/18/19  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

5.676 Views

Untitledvor 0 min.
Member 862464105/12/24
Axel Berse11/02/23
Stefan8105/07/21
p.specht04/18/21
More...

Themeninformationen

this Topic has 2 subscriber:

p.specht (1x)
Andreas Miethe (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie