![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Feb 2008
Posts: 13
Rep Power: 0
![]() |
I tried to program a windows toolbar and I thought that the code was right but for some reason it does not display the custom bitmap that I am trying to use. It displays the button but no bitmap on it. This is the code:
INITCOMMONCONTROLSEX initctrs;
initctrs.dwSize = sizeof(INITCOMMONCONTROLSEX);
initctrs.dwICC = ICC_BAR_CLASSES;
InitCommonControlsEx(&initctrs);
TBBUTTON button[1];
button[0].iBitmap = 0;
button[0].idCommand = IDM_NEW;\\<-From resource file
button[0].fsState = TBSTATE_ENABLED;
button[0].fsStyle = TBSTYLE_BUTTON;
button[0].dwData = 0L;
button[0].iString = 0;
HWND tool;
tool = CreateToolbarEx(hwnd,
WS_CHILD | WS_VISIBLE | WS_BORDER,
IDB_BIT,\\ <- IDB_BIT is the Bitmap resource.
1,
hInst_menu,
IDB_BIT,\\ <- IDB_BIT is the Bitmap resource.
button,
1,
16,16,16,16,
sizeof(TBBUTTON));I do not know if I am missing something obvious or if I need to Load the bitmap before I use it in this context. Any help will be great. |
|
|
|
|
|
#2 |
|
Programmer
Join Date: Feb 2006
Location: Ohio
Posts: 93
Rep Power: 3
![]() |
Re: Win32 toolbar Programming
You can load the bitmap first, using LoadImage. Then you would want to change hInst_menu in your CreateToolbarEx call to NULL, and put the HBITMAP handle where IDB_BIT is.
You might want to try something else, first though. I'm not 100% sure this will work, but it's worth a shot. It looks like IDB_BIT is the numeric ID of the bitmap. Correct? You may want to try MAKEINTRESOURCE(IDB_BIT), instead of just IDB_BIT.
__________________
Neeley.org |
|
|
|
|
|
#3 |
|
Newbie
Join Date: Feb 2008
Posts: 13
Rep Power: 0
![]() |
Re: Win32 toolbar Programming
Loading the image first worked perfectly but I also tried MAKEINTRESOURCE and it did not work because it was telling me that I could not convert the UINT from the MAKEINTRESOURCE into LPWSTR. I tried typcasting but that still did not work. I do think that there is a way to do it without manually loading the bitmap because I saw it in a tutorial that I found but I did not go totally in depth.
|
|
|
|
|
|
#4 |
|
Newbie
Join Date: Feb 2008
Posts: 13
Rep Power: 0
![]() |
Re: Win32 toolbar Programming
Fixed the LPWSTR issue but still does not work.
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [WANTED] Programming Partner for Browser Toolbar Development | sabian | Paid Job Offers | 7 | Apr 6th, 2006 9:30 AM |
| win32 programming question | Brent | C++ | 4 | Oct 12th, 2005 3:31 PM |
| Question about Win32 Programming | brokenhope | C++ | 15 | May 3rd, 2005 7:55 PM |
| Win32 Programming | brokenhope | C++ | 10 | Apr 29th, 2005 5:08 PM |