Toolbar in IE anzeigen ... ?
-
Hi,
Ich weiß dass es hier schon ahnliche Thread gab aber ich finde einfach keine Lösung zu meinem Problem
Ich will die Toolbar die ich mit CreateToolbarEx() erstelle an den IE versenden dass er im der Anpassen... Dialog ist und das mit SendMessage(hwnd_toolbar, TB_CUSTOMIZE, NULL, NULL); aber irgendwie klappt das nicht. Hier der Code :#define _WIN32_IE 0x501 //For TBSTYLE_FLAT Konstante #include <windows.h> #include <iostream.h> #include <commctrl.h> //For extended controls LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); int button_id = 0; HWND hwnd_toolbar, hwnd; void tb_add_separator( HWND hwnd_toolbar ) { if (hwnd_toolbar != NULL) //Continue only if there is a toolbar { TBBUTTON tbbutton; //Create TBBUTTON-Structur for saving infos about button which is to add tbbutton.iBitmap = NULL; tbbutton.idCommand = NULL; //Command-Parameter to Command-Message to recognize clicks on Toolbar-Button tbbutton.fsState = NULL; tbbutton.fsStyle = TBSTYLE_SEP; tbbutton.dwData = NULL; tbbutton.iString = NULL; SendMessage(hwnd_toolbar, TB_ADDBUTTONS, (WPARAM) 1, (LPARAM) (LPTBBUTTON) &tbbutton); } } void tb_add_button(HWND hwnd_toolbar, int command, char* bitmap_filename, int style = TBSTYLE_BUTTON) { if (hwnd_toolbar != NULL) //Continue only if there is a toolbar { //Bitmap einladen HBITMAP h_bitmap; h_bitmap = (HBITMAP)LoadImage( NULL, bitmap_filename, // name or identifier of image IMAGE_BITMAP, // type of image 16, // desired width 16, // desired height LR_LOADFROMFILE // load flags ); //fill ADDBITMAP-Structur and overgive Bitmap-Handle TBADDBITMAP bitid; bitid.hInst = NULL; bitid.nID = (UINT)h_bitmap; TBBUTTON tbbutton; //Create TBBUTTON-Structur for saving infos about button which is to add tbbutton.iBitmap = SendMessage(hwnd_toolbar, TB_ADDBITMAP, 1, (long)&bitid); tbbutton.idCommand = command; //Command-Parameter to Command-Message to recognize clicks on Toolbar-Button tbbutton.fsState = TBSTATE_ENABLED; tbbutton.fsStyle = style; tbbutton.dwData = 0; tbbutton.iString = NULL; //At last, add the button to the Toolbar SendMessage(hwnd_toolbar, TB_ADDBUTTONS, (WPARAM) 1, (LPARAM) (LPTBBUTTON) &tbbutton); } } HWND tb_create( HINSTANCE instance, HWND hwnd, int style ) { InitCommonControls(); //Create window for toolbar, parent is current window HWND hwnd_toolbar = CreateWindowEx( 0, TOOLBARCLASSNAME, (LPSTR) NULL, WS_CHILD | style, 0, 0, 0, 0, hwnd, (HMENU) 1, instance, NULL ); if (!hwnd) //Continue if creating toolbar was successfull { return NULL; } //Add Standard-Buttons to toolbar's Image-List TBADDBITMAP bitid; bitid.hInst = HINST_COMMCTRL; bitid.nID = IDB_STD_SMALL_COLOR; SendMessage(hwnd_toolbar, TB_ADDBITMAP, 1, (long)&bitid); SendMessage(hwnd_toolbar, TB_BUTTONSTRUCTSIZE, (WPARAM) sizeof(TBBUTTON), 0); //Backward compatiblity ShowWindow(hwnd_toolbar, SW_SHOW); //Show Toolbar! return hwnd_toolbar; } int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int showpref) { static char AppName[] = "WinTextedit 1.0"; MSG msg; WNDCLASS wndclass; wndclass.style = NULL; wndclass.lpfnWndProc = WndProc; wndclass.cbClsExtra = 0; wndclass.cbWndExtra = 0; wndclass.hInstance = hInstance; wndclass.hIcon = LoadIcon(NULL, IDI_WINLOGO); wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); wndclass.hbrBackground = (HBRUSH) COLOR_MENU + 3; wndclass.lpszMenuName = NULL; wndclass.lpszClassName = AppName; if (RegisterClass(&wndclass) == false) { MessageBox(NULL, "Es ist ein Fehler aufgetreten. ", "Error! ", MB_ICONERROR); return 0; } hwnd = CreateWindow (AppName, TEXT("Toolbar-Testprogramm"), WS_OVERLAPPEDWINDOW, 100, 100, 258, 314, NULL, NULL, hInstance, NULL); ShowWindow(hwnd, SW_SHOWNORMAL); UpdateWindow(hwnd); hwnd_toolbar = tb_create(hInstance, hwnd, TBSTYLE_FLAT); tb_add_button(hwnd_toolbar, 1, "bitmap.bmp", TBSTYLE_CHECK); tb_add_button(hwnd_toolbar, 2, "bitmap.bmp", TBSTYLE_CHECK); tb_add_button(hwnd_toolbar, 3, "bitmap.bmp", TBSTYLE_CHECK); tb_add_separator(hwnd_toolbar); tb_add_button(hwnd_toolbar, 4, "bitmap.bmp"); tb_add_button(hwnd_toolbar, 5, "bitmap.bmp"); SendMessage(hwnd_toolbar, TB_CUSTOMIZE, NULL, NULL); /* Hier die nachricht ???????? */ while(GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } return msg.wParam; } LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case WM_COMMAND: button_id = LOWORD(wParam); return 0; case WM_DESTROY: PostQuitMessage(0); return 0; } return DefWindowProc(hwnd, message, wParam, lParam); }Ich hoffe ihr könnt mir helfen .
Gruß
-
Ich verstehe nicht so ganz, was du vorhast - vielleicht findest du hier was passendes für dich...
-
Danke für die Antwort also ich will eine einfache Toolbar für den IE erstellen
so wie von google oder so ...Gruß

-
Ok, dann solltest du dort richtig sein - speziell "Adding Explorer Bars"
