Declare Edit1&,Edit2&,Edit3&,Button1&,Button2&,Brush& Declare Ende&,OldWindowProc& $H windows.ph $H messages.ph set("FastMode",1) PROC SetColor 'Behandlungroutine für 'WM_CTLCOLORSTATIC,WM_CTLCOLOREDIT und WM_CTLCOLORLISTBOX 'es wird ein farbiger Brush angelegt und die Textfarbe bestimmt Parameters col&,bk&,wParam& IF Brush& ~DeleteObject(Brush&) Endif Brush& = ~CreateSolidBrush(bk&) ~SetBkMode(wParam&, ~TRANSPARENT) ~SetTextColor(wParam&,col&) Return Brush& Endproc Proc Windowproc parameters Wnd&, Msg&, wParam&, lParam& If Msg& = ~WM_CLOSE 'Aufräumen IF Brush& ~DeleteObject(Brush&) Endif ~PostQuitMessage(Wnd&,0,0) Endif If Msg& = ~WM_CTLCOLOREDIT If lParam& = Edit1& Return SetColor(rgb(255,0,0),rgb(255,255,0),wParam&) Elseif lParam& = Edit2& Return SetColor(rgb(0,0,128),rgb(255,0,255),wParam&) Elseif lParam& = Edit3& Return SetColor(rgb(255,255,255),rgb(0,0,128),wParam&) Endif Endif If Msg& = ~WM_COMMAND IF lParam& = Button1& 'Button1 abfragen IF (wParam& >> 16) = ~BN_CLICKED 'HiWord ~Messagebox(0,"Button1 Klick","Meldung",0) Endif Endif IF lParam& = Button2& 'Button2 abfragen IF (wParam& >> 16) = ~BN_CLICKED 'HiWord ~Messagebox(0,"Button2 Klick","Meldung",0) Endif Endif Endif 'alle nicht behandelten Meldungen an die Originalprozedur weiterleiten Return ~CallWindowProc(OldWindowproc&,Wnd&, Msg&, WParam&, LParam&) Endproc WindowStyle 543 cls ~GetSysColor(~COLOR_BTNFACE) 'ein paar Controls anlegen Edit1& = Create("Edit",%Hwnd,"Edit1",10,10,80,20) Sendmessage(Edit1&,~WM_SETFONT,~GetStockObject(~DEFAULT_GUI_FONT),1) Edit2& = Create("Edit",%Hwnd,"Edit2",10,40,80,20) Sendmessage(Edit2&,~WM_SETFONT,~GetStockObject(~DEFAULT_GUI_FONT),1) Edit3& = Create("Edit",%Hwnd,"Edit3",10,70,80,20) Sendmessage(Edit3&,~WM_SETFONT,~GetStockObject(~DEFAULT_GUI_FONT),1) Button1& = Create("Button",%Hwnd,"Button1",10,110,80,20) Sendmessage(Button1&,~WM_SETFONT,~GetStockObject(~DEFAULT_GUI_FONT),1) Button2& = Create("Button",%Hwnd,"Button2",10,150,80,20) Sendmessage(Button2&,~WM_SETFONT,~GetStockObject(~DEFAULT_GUI_FONT),1) 'Window-Prozedur austauschen OldWindowproc& = ~SetWindowLong(%hwnd,~GWL_WNDPROC, ProcAddr(WindowProc,4)) Whilenot Ende& waitinput EndWhile end