Andris Spruds
May 29th, 1999, 02:21 AM
Hello,
I'm trying to write a program that will change Windows appearence. But just hanged
up with basics - how to change windows class background for local app
(using SetClassLong), for example I want all buttons created in my app to be red.
Any advices ?
I use the following code (without success, of course) :
const COLORREF RED = RGB(255,0,0);
HBRUSH B = CreateSolidBrush(RED);
HWND hwnd;
hwnd = CreateWindow(
"BUTTON", // name of window class
"Sample", // title-bar string
WS_OVERLAPPEDWINDOW, // top-level window
10, // default horizontal position
10, // default vertical position
100, // default width
100, // default height
(HWND) NULL, // no owner window
(HMENU) NULL, // use class menu
AfxGetInstanceHandle(), // handle of application instance
(LPVOID) NULL); // no window-creation data
SetLastError(0);
DWORD dwresult;
dwresult=::SetClassLong(hwnd,GCL_HBRBACKGROUND,(LONG)B);
if (dwresult==0) {
AfxMessageBox("Error");
}
else {
AfxMessageBox("OK");
}
I'm trying to write a program that will change Windows appearence. But just hanged
up with basics - how to change windows class background for local app
(using SetClassLong), for example I want all buttons created in my app to be red.
Any advices ?
I use the following code (without success, of course) :
const COLORREF RED = RGB(255,0,0);
HBRUSH B = CreateSolidBrush(RED);
HWND hwnd;
hwnd = CreateWindow(
"BUTTON", // name of window class
"Sample", // title-bar string
WS_OVERLAPPEDWINDOW, // top-level window
10, // default horizontal position
10, // default vertical position
100, // default width
100, // default height
(HWND) NULL, // no owner window
(HMENU) NULL, // use class menu
AfxGetInstanceHandle(), // handle of application instance
(LPVOID) NULL); // no window-creation data
SetLastError(0);
DWORD dwresult;
dwresult=::SetClassLong(hwnd,GCL_HBRBACKGROUND,(LONG)B);
if (dwresult==0) {
AfxMessageBox("Error");
}
else {
AfxMessageBox("OK");
}