|
-
May 29th, 1999, 02:21 AM
#1
How to use SetClassLong ?
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");
}
-
May 31st, 1999, 04:45 AM
#2
Re: How to use SetClassLong ?
Hello:
I tried to changed the static-control's background brush and failed,
perhaps the controls draw themselves without the class's brushes but others.
If you want to change the button-controls, try to use own-draw,
it should work.
Best Regards!
-
May 31st, 1999, 10:21 AM
#3
Re: How to use SetClassLong ?
No, it's impossible. I'm trying to subclass window in another application.
Thanks,
Andris
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|