在單文檔的 VIEW類裏
SetClassLong(GetSafeHwnd(),GCL_HBRBACKGROUND,(LONG)GetStockObject(2));
改變背景是可以的 能夠立即看出來
但是要是對話框裏的oncreate裏需要重繪
InvalidateRect(NULL,TRUE);
這樣纔會看出效果
From MSDN:
Use the SetClassLong function with care. For example, it is possible to change the background color for a class by using SetClassLong, but this change does not immediately repaint all windows belonging to the class
/*#define WHITE_BRUSH 0
#define LTGRAY_BRUSH 1
#define GRAY_BRUSH 2
#define DKGRAY_BRUSH 3
#define BLACK_BRUSH 4
#define NULL_BRUSH 5
#define HOLLOW_BRUSH NULL_BRUSH*/