;Autor: Inf0Byt3 ;http://www.purebasic.fr/english/viewtopic.php?p=404516#p404516 EnableExplicit Global hBrush = CreateSolidBrush_(RGB(255, 0, 0)) Procedure Callback(hWnd, uMsg, wParam, lParam) Select uMsg Case #WM_CTLCOLORBTN If lParam = GadgetID(2) ProcedureReturn hBrush EndIf EndSelect ProcedureReturn #PB_ProcessPureBasicEvents EndProcedure If OpenWindow(0, 0, 0, 500, 400, "Window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) ButtonGadget(1, 10, 10, 100, 20, "Button 1") ButtonGadget(2, 10, 40, 100, 20, "Button 2") SetWindowColor(0, RGB(255, 0, 0)) SetWindowCallback(@Callback(), 0) Repeat Select WaitWindowEvent() Case #PB_Event_CloseWindow DeleteObject_(hBrush) End EndSelect ForEver EndIf