/* GUIBEGIN WINDOW , 0, 0, 400, 200, POPUP|CAPTION|SYSMENU|MINBOX|MAXBOX|THICK, , Custom Background Color FONT 8, 400, MS Shell Dlg DEND GUIEND */ /* An example of a custom background color for the window. */ LIBRARY rexxgui GuiErr = "SYNTAX" GuiHeading = 1 /* FUNCDEF some stuff */ DO FUNCDEF("CreateSolidBrush", "32u, 32u", "gdi32") FUNCDEF("SelectObject", "32u, 32u, 32u", "gdi32") RECT = "32u, 32u, 32u, 32u" FUNCDEF("FillRect", ", 32u, struct RECT, 32u", "user32") FUNCDEF("DeleteBrush", ", 32u", "gdi32", "DeleteObject") CATCH FAILURE CONDITION('M') RETURN END /* Get a custom brush with an RGB color of 100, 175, 150 */ Color = (100 * 65536) + (175 * 256) + 150 Brush = CreateSolidBrush(Color) /* Since we'll be doing our own painting of windows, then don't let the * operating system automatically erase the window background. We also * need our PAINT handler called whenever the window is resized, so we * specify the VREDRAW|HREDRAW styles */ GuiWindowDefaults(, , 0, 'VREDRAW|HREDRAW') GuiCreateWindow('NORMAL') Again: DO FOREVER GuiGetMsg() CATCH SYNTAX CONDITION('M') SIGNAL Again CATCH HALT FINALLY GuiDestroyWindow() /* Destroy our custom brush */ DeleteBrush(Brush) END RETURN /* Called by Reginald whenever our window needs its background drawn. This * handler is tricky. It should never, never create another window nor display a * message box. All it should ever do is draw our window background. And that's it. */ WM_ERASEBKGND: context = ARG(1) /* Get the window's width/height */ GuiGetCtlPlacement(GuiWindow, , , 'Width', 'Height') /* Use our custom brush */ temp = SelectObject(context, Brush) /* Fill in the window */ Rect.1 = 0 Rect.2 = 0 Rect.3 = Width Rect.4 = Height FillRect(context, Rect, Brush) /* Restore orig brush */ SelectObject(context, temp) /* Indicate we did the background */ RETURN 1