CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 1999
    Location
    Latvia
    Posts
    30

    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");
    }





  2. #2
    Join Date
    May 1999
    Posts
    11

    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!





  3. #3
    Join Date
    May 1999
    Location
    Latvia
    Posts
    30

    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
  •  





Click Here to Expand Forum to Full Width

Featured