Dockable Toolbar (Like taskbar or office toolbar)

This is a discussion on Dockable Toolbar (Like taskbar or office toolbar) within the Windows Programming forums, part of the Platform Specific Boards category; Hi, I want to create a toolbar that I can dock to the top edge of my screen. I have ...

  1. #1
    Registered User
    Join Date
    Oct 2005
    Posts
    18

    Dockable Toolbar (Like taskbar or office toolbar)

    Hi,

    I want to create a toolbar that I can dock to the top edge of my screen. I have written some code that creates a bar at the top of my screen, but the problem is that it covers up the title bar of other windows. So what I want to do is to make the maximum size of other windows smaller, so even if I maximize them, they will not go over/under the toolbar.

    My current code is this:

    Code:
    #include <windows.h>
    
    LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
    
    char szClassName[ ] = "Toolbar";
    
    int WINAPI WinMain (HINSTANCE hThisInstance,
                        HINSTANCE hPrevInstance,
                        LPSTR lpszArgument,
                        int nFunsterStil)
    
    {
        HWND hwnd;            
        MSG messages;         
        WNDCLASSEX wincl;     
    
    
        wincl.hInstance = hThisInstance;
        wincl.lpszClassName = szClassName;
        wincl.lpfnWndProc = WindowProcedure;    
        wincl.style = CS_DBLCLKS;         
        wincl.cbSize = sizeof (WNDCLASSEX);
    
    
        wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
        wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
        wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
        wincl.lpszMenuName = NULL;            
        wincl.cbClsExtra = 0;                   
        wincl.cbWndExtra = 0;                    
    
        wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
    
    
        if (!RegisterClassEx (&wincl))
            return 0;
    
     
        hwnd = CreateWindowEx (
               0,                 
               szClassName,         
               "Toolbar",     
               WS_POPUP | WS_EX_TOOLWINDOW | WS_BORDER, 
               0,      
               0,     
               1280,                
               30,               
               HWND_DESKTOP,        
               NULL,                
               hThisInstance,       
               NULL                 
               );
    
    
        ShowWindow (hwnd, nFunsterStil);
        SetWindowPos ( hwnd, HWND_TOPMOST, 0, 0, 0, 0,SWP_NOMOVE|SWP_NOSIZE );
    
        while (GetMessage (&messages, NULL, 0, 0))
        {
    
            TranslateMessage(&messages);
    
            DispatchMessage(&messages);
        }
    
       
        return messages.wParam;
    }
    
    
    
    
    LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
    {
        switch (message)                  
        {
            case WM_DESTROY:
                PostQuitMessage (0);       
                break;
            default:                    
                return DefWindowProc (hwnd, message, wParam, lParam);
        }
    
        return 0;
    }
    Thanks!

    -Ben
    Check out my blog!
    http://www.om3ga.co.uk

  2. #2
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544

  3. #3
    Registered User
    Join Date
    Oct 2005
    Posts
    18
    Thanks!

    -Ben
    Check out my blog!
    http://www.om3ga.co.uk

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 06-07-2002, 03:33 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21