toolbar - tooltip



  • hi zusammen,
    ich habe ein kleines problem 😞
    die tooltips bei meiner toolbar werden durcheinander bzw. garnicht angezeigt...
    hier der codeauschnitt :

    #include <windows.h>
    #include <commctrl.h>
    
    #define NUM_BUTTON_BITMAPS 5
    
    #define ID_BUTTON_ADD      1
    #define ID_DAT_OPEN        2
    #define ID_BUTTON_FIND     3
    #define ID_BUTTON_DEL      4
    
    LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){
        static HWND hToolBar ;
        LPTOOLTIPTEXT lpttt ;
        static HINSTANCE hInstance ;
        switch (message){
            case WM_CREATE :
                hInstance = ((LPCREATESTRUCT) lParam) -> hInstance ;
                hToolBar = CreateAToolBar (hwnd, hInstance) ;
                return 0 ;
            case WM_NOTIFY:
                switch (LPNMHDR (lParam)->code){
                    case TTN_GETDISPINFO : 
                        lpttt = (LPTOOLTIPTEXT) lParam ; 
                        lpttt->hinst = (HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE) ;
                        switch (lpttt->hdr.idFrom){
                            case STD_FILENEW :
                                lpttt->lpszText = "new" ; 
                                break ;
                            case STD_FILEOPEN :
                                lpttt->lpszText = "file open" ;
                                break ;
                            case STD_FIND :
                                lpttt->lpszText = "find" ;
                                break ;
                            case STD_DELETE :
                                lpttt->lpszText = "delete" ;
                                break ;
                       }
                       break ;
                }
                return 0 ;
            case WM_DESTROY :
                PostQuitMessage (0) ;
                return 0 ;
        }
        return DefWindowProc (hwnd, message, wParam, lParam) ;
    }
    
    HWND CreateAToolBar (HWND hwndParent, HINSTANCE hInstanceParent){ 
        HWND hwndTB ;
        TBADDBITMAP tbab ;
        TBBUTTON tbButton [] =	{{STD_FILENEW, ID_BUTTON_ADD, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0L, 0},
                                   {STD_FILEOPEN, ID_DAT_OPEN, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0L, 0},
                                   {STD_FIND, ID_BUTTON_FIND, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0L, 0},
                                   {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0L, 0},
                                   {STD_DELETE, ID_BUTTON_DEL, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0L, 0}} ;
        InitCommonControls () ;
        tbab.hInst = HINST_COMMCTRL ;
        tbab.nID = IDB_STD_SMALL_COLOR ;
        hwndTB = CreateToolbarEx (hwndParent,WS_CHILD | WS_VISIBLE | TBSTYLE_FLAT | TBSTYLE_TOOLTIPS, ID_TOOLBAR, NUM_BUTTON_BITMAPS, hInstanceParent, ID_TOOLBAR, NULL, NULL, 0, 0, 0, 0, sizeof (TBBUTTON)) ;
        SendMessage (hwndTB, TB_ADDBITMAP, (WPARAM) NUM_BUTTON_BITMAPS, (WPARAM) &tbab) ;
        SendMessage (hwndTB, TB_ADDBUTTONS, (WPARAM) NUM_BUTTON_BITMAPS, (LPARAM) (LPTBBUTTON) &tbButton) ;
        return hwndTB ;
    }
    

    thx



  • hat sich erledigt.


Anmelden zum Antworten