First ,I'm English is no Good,
I'll do my best to Write the word:

1: I want change the value in class of window to change the window's
backcolor:

.386
.model flat,stdcall
option casemap:none

include \masm32\include\windows.inc
include \masm32\include\user32.inc
includelib \masm32\lib\user32.lib
include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib
include \masm32\include\gdi32.inc
includelib \masm32\lib\gdi32.lib

.DATA
WinName db "Form1",0

.DATA?
hWnd HINSTANCE ?

.CODE
start:
invoke FindWindow,NULL,addr WinName
mov hWnd,eax
invoke SetClassLong,hWnd,GCL_HBRBACKGROUND,16
invoke ExitProcess,eax

END start

but,something wrong, no thing happened!



2 i want change note's backcolor,creat a red rush to fill it:

.386
.model flat,stdcall
option casemap:none

WinMain proto :DWORD,:DWORD,:DWORD,:DWORD

include \masm32\include\windows.inc
include \masm32\include\user32.inc
includelib \masm32\lib\user32.lib
include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib
include \masm32\include\gdi32.inc
includelib \masm32\lib\gdi32.lib

RGB macro red,green,blue
xor eax,eax
mov ah,blue
shl eax,8
mov ah,green
mov al,red
endm

.DATA
WinName db "???? - ???",0
MsgBoxCaption db "HoHo",0
MsgFormat db '%d',0
szBuffer db 64 dup(?)
rect RECT <0,0,500,500>

.DATA?
hWnd HINSTANCE ?
ps PAINTSTRUCT <>
hdc HDC ?
rushnew HBRUSH ?

.CODE
start:
invoke FindWindow,NULL,addr WinName
mov hWnd,eax
invoke GetDC,hWnd
mov hdc,eax
RGB 255,0,0
invoke CreateSolidBrush,eax
mov rushnew,eax
invoke SelectObject,hdc,addr rushnew
invoke Rectangle,hdc,0,0,500,500
invoke FillRect,hdc,addr rect,rushnew
invoke ExitProcess,eax

END start

but whatever I use what color of rush,it backcolor always white!

Thanks again! :shock:
Posted on 2004-10-25 00:14:14 by keyif
You normally set the brush colour in the WNDCLASSEX structure used for the following call to CreateWindowEx. From memory when you want to change this on the fly you use SetWindowLong to change the background brush for a window. These colours only effect the client area, not the rest of the window.
Posted on 2004-10-25 02:34:12 by hutch--
Please Give Me a Example,Thanks.
Posted on 2004-10-25 03:45:00 by keyif
The MASM32 project is full of them. Any window that is created with CreateWindowEx() must have a WNDCLASSEX structure with the correct class parameters in it. The background brush is one of them.
Posted on 2004-10-25 05:55:31 by hutch--
chinese?hehe,me too
Posted on 2004-10-25 06:32:38 by yafeng
According to the Win32 Programmer's Reference, the 1st parameter for the FindWindow function must be a pointer to the window's class name string. The use of NULL does not seem to be an option as for the 2nd parameter.

Raymond
Posted on 2004-10-25 09:35:30 by Raymond
According to the Win32 Programmer's Reference, the 1st parameter for the FindWindow function must be a pointer to the window's class name string. The use of NULL does not seem to be an option as for the 2nd parameter.

I suggest you get a better reference then. According to MSDN it can be either the class name, class atom or NULL.
Posted on 2004-10-25 10:35:01 by death