Thread: "Skins" on windows

  1. #1
    Registered User
    Join Date
    Nov 2003
    Posts
    5

    Question "Skins" on windows

    This question may encompass far more than I'm ready to handle, but I haven't found the answer elsewhere --

    I'm creating an app that 1.) I don't want a title bar on, and 2.) I want my own custom skin that I create to be used rather than the default Windows look.

    Could someone point me in the right direction on these two questions.

    Thank you in advance,

    exle

  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    The "title bar" is added if you include WS_CAPTION style, (some of the other composite styles set this for you), browse the WS_settings and decide what you want.

    To draw your own window frames etc., you need to intercept and process WM_NCxxxx messages - Non Client area messages. Look them up in the help.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  3. #3
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    also have a look at

    WM_PAINT
    CreateCompatibleDC()
    CreateCompatibleBitmap()
    SelectObject()
    DeleteObject()
    BitBlt()

    and for the skin

    CreatePatternBrush()
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  4. #4
    Registered User Dante Shamest's Avatar
    Join Date
    Apr 2003
    Posts
    970
    Here's a pretty good tutorial on skinning windows.
    http://www.flipcode.com/articles/art...n32skins.shtml

  5. #5
    Registered User
    Join Date
    Nov 2003
    Posts
    5
    I got the regions/skins working with that tutorial (thanks) -

    Now I have to figure out how to do child windows.. can anyone point me somewhere for this one?

    My source code (very messy, its 5am) - www.rednax.net/c/bar.cpp, www.rednax.net/c/rednaxBar.exe

    Thanks

    exle

  6. #6
    if you want to use bitmaps for the buttons, don't know if that's the idea:

    hbmp=the HBITMAP of the BMP file or resource for the button in normal state
    hbmp_pressed=the HBITMAP of the BMP file for the button in pressed state

    so for every button, you need at least two bitmaps

    Code:
    LPDRAWITEMSTRUCT lpdis;
    HDC hdc,hdcMem;
    ...
    WM_CREATE:
    ...
    hbutton = CreateWindow("button",NULL,WS_CHILD|WS_VISIBLE|BS_OWNERDRAW,0,0,0,0,hwnd,(HMENU)MYBUTTON,hinstance,NULL);
    //also load the bitmaps here
    ...
    
    case WM_DRAWITEM :
    lpdis = (LPDRAWITEMSTRUCT) lParam; 
    hdcMem = CreateCompatibleDC(lpdis->hDC); 
    switch(lpdis->CtlID)//if the button is not pressed
    {
    case MYBUTTON:
    SelectObject(hdcMem, hbmp); 
    StretchBlt(lpdis->hDC, lpdis->rcItem.left,lpdis->rcItem.top, lpdis->rcItem.right - lpdis->rcItem.left, lpdis->rcItem.bottom - lpdis->rcItem.top, hdcMem,0,0,mybuttonwidth,mybuttonheight,SRCCOPY);
    break;
    }
    if(lpdis->itemState & ODS_SELECTED)//if the button is pressed
    {
    switch(lpdis->CtlID)
    {
    case MYBUTTON:
    SelectObject(hdcMem, hbmp_pressed); 
    StretchBlt(lpdis->hDC, lpdis->rcItem.left,lpdis->rcItem.top, lpdis->rcItem.right - lpdis->rcItem.left, lpdis->rcItem.bottom - lpdis->rcItem.top, hdcMem,0, 0,mybuttonwidth,mybuttonheight,SRCCOPY);
    break;
    }
    DeleteDC(hdcMem);
    return 0;

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Windows 98/2000 programming in Windows XP
    By Bill83 in forum Windows Programming
    Replies: 3
    Last Post: 07-22-2005, 02:16 PM
  2. Dialog Box Problems
    By Morgul in forum Windows Programming
    Replies: 21
    Last Post: 05-31-2005, 05:48 PM
  3. dual boot Win XP, win 2000
    By Micko in forum Tech Board
    Replies: 6
    Last Post: 05-30-2005, 02:55 PM
  4. SDL and Windows
    By nickname_changed in forum Windows Programming
    Replies: 14
    Last Post: 10-24-2003, 12:19 AM
  5. IE 6 status bar
    By DavidP in forum Tech Board
    Replies: 15
    Last Post: 10-23-2002, 05:31 PM