flat assembler
Message board for the users of flat assembler.
  
|  Index
      > Windows > Child window with different color | 
| Author | 
 | 
| AsmGuru62 17 Feb 2014, 14:10 I think the frame window (a parent for child windows) should not have the
 same WndProc as a child window. It, kind of, contradicts the proper application design. And once you have separate procedures - have a child window respond to WM_ERASEBKGND and paint the background with currently selected brush (a global COLORREF variable). I can try and create a prototype for you. | |||
| 
 | 
| clamicun 17 Feb 2014, 16:33 Yes thank you!
 Seems that, if I only want to change the color I can use the same WindowProc, but have to register a new class. ; _childclass TCHAR 'chwin',0 wcch WNDCLASS ,WindowProc,0,0,NULL,NULL,NULL,hbrBackground,NULL,_childclass invoke GetModuleHandle,0 mov [wcch.hInstance],eax invoke CreateSolidBrush,BLUE mov [wcch.hbrBackground],eax invoke RegisterClass,wcch invoke CreateWindowEx,WS_EX_CLIENTEDGE,_chclass,NULL,WS_CHILD+WS_VISIBLE,\ 90,90,180,130,[wndhandle],NULL,[wcch.hInstance],NULL | |||
| 
 | 
| baldr 17 Feb 2014, 20:24 clamicun,
 WNDCLASS.cbWndExtra can be used to allocate some per-window memory, accessible with Get/SetWindowLong(). You may use Get/SetProp() if you're not into offsets that much. This extra memory can be used to store brush handle for WM_ERASEBKGND handling. Separate window class for each background color looks like overkill. | |||
| 
 | 
| AsmGuru62 17 Feb 2014, 22:40 @clamicun:
 I have attached some working code. 
 | |||||||||||
| 
 | 
| < Last Thread | Next Thread > | 
| Forum Rules: 
 | 
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.