Need help with adding a toolbar to a windows application

Every time i pass the window style value "TBSTYLE_WRAPABLE" to the CreateWindowEx() API function, i get the compiler error "TBSTYLE_WRAPABLE was not declared in this scope". But i am sure i spelled out the value correctly and also made sure that the window was created inside the WinMain function. Can anyone help me?

Here is the code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nCmdShow)
{
    HWND MainWindow;                                      
    MSG messages;                                   
    WNDCLASSEX winclass;                            

    winclass = CreateWindowClass (winclass, hThisInstance);       

    RegisterClassEx (&winclass);                                  

    /*Creating MAIN windows*/
    MainWindow = CreateWindowEx (
           0,                               /* Extended possibilities for variation */
           "Main Class" | TOOLBARCLASSNAME,   /* Classname */
           "My Awesome Window!",        /* Title Text */
           WS_OVERLAPPEDWINDOW |            /* Window Styles */
           WS_HSCROLL | WS_VSCROLL
           | TBSTYLE_WRAPABLE,            /*HERE IS THE ERROR */
           CW_USEDEFAULT,                   /* Windows decides the position */
           CW_USEDEFAULT,                   /* where the window ends up on the screen */
           CW_USEDEFAULT,                   /* The programs width */
           CW_USEDEFAULT,                   /* and height in pixels */
           HWND_DESKTOP,                    /* The window is a child-window to desktop */
           NULL,                            /* No menu */
           hThisInstance,                   /* Program Instance handler */
           NULL                             /* No Window Creation data */
           );


    ShowWindow (MainWindow, nCmdShow);            

    while (GetMessage (&messages, NULL, 0, 0))
    {
        TranslateMessage(&messages);        
        DispatchMessage(&messages);         
    }

    return messages.wParam;                 
}
Last edited on
This value is defined in CommCtrl.h like so:

#define TBSTYLE_WRAPABLE 0x0200

If your implementation of the header doesn't have that then you can define it yourself.
What exactly is the 0x0200? is that the address of TBSTYLE_WRAPABLE?

do i also have to do that for TOOLBARCLASSNAME?
Do you know how #define works? 0x0200 is the actual style flag. TBSTYLE_WRAPABLE is only a symbolic constant that is replaced in all instances in your code with 0x0200.

BTW did you include CommCtrl.h in your project? It should have both TBSTYLE_WRAPABLE and TOOLBARCLASSNAME in it.
Topic archived. No new replies allowed.