views:

509

answers:

2

Every program does have the scrollbar above the status bar. Right? Well, not mine.

When i tried to set up my own scroll bars in my program, i suprisingly made them work! So did i manage to get the status bar work too! Hurray! :-) ...But the status bar is ABOVE the scroll bar, when it should be UNDER the scroll bar. How do i move the scrollbar? i couldnt find any functions about moving the scrollbar. unless i create a scrollbar window myself, but that didnt work very well (*it had some weird bug: when i used default height, it became completely invisible scroll bar, and when i used my defined height, the scrollbar had Windows98 theme or something o_O* !)

Here is my status bar creation code:

// Create status bar
hStatus = CreateWindowEx(
    0, 
    STATUSCLASSNAME, 
    NULL, 
    WS_CHILD | WS_VISIBLE | SBARS_SIZEGRIP, 
    0, 0, 0, 0, 
    hWnd, 
    (HMENU)IDC_MAIN_STATUS, 
    GetModuleHandle(NULL), 
    NULL
);

and the window creation:

if (!(hWnd=CreateWindowEx(dwExStyle,      // Extended Style For The Window
    "OpenGL",     // Class Name
    title,      // Window Title
    dwStyle |     // Defined Window Style
    WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS | 
    WS_CLIPCHILDREN | WM_HSCROLL | WM_VSCROLL, // Required Window Style
    0, 0,      // Window Position
    WindowRect.right-WindowRect.left,  // Calculate Window Width
    WindowRect.bottom-WindowRect.top,  // Calculate Window Height
    NULL,      // No Parent Window
    NULL,      // No Menu
    hInstance,     // Instance
    NULL)))      // Dont Pass Anything To WM_CREATE

There must be some neat trick which i havent realised yet, anyone enlighten me on how to do this properly?

+2  A: 

Run notepad and inspect it with spy++ and you'll see the area with the scroll bar and the status bar are two peer windows with a common parent. You need to do this as well, then use SetWindowPos() to position your two windows relative to each other whenever your parent window changes size or position.

jeffamaphone
A: 

Mind linking to that sample code? I havent found any so far

You should arm yourself with Petzold's book "Programming Windows, 5th ed." See http://www.charlespetzold.com/pw5/index.html
jeffamaphone
i meant that sample code in the MSDN, plus that book page has full of dead links.