Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Feb 23rd, 2008, 10:32 PM   #1
slicksk8te
Newbie
 
Join Date: Feb 2008
Posts: 13
Rep Power: 0 slicksk8te is on a distinguished road
Question Win32 toolbar Programming

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.
slicksk8te is offline   Reply With Quote
Old Feb 24th, 2008, 12:13 AM   #2
dr.p
Programmer
 
dr.p's Avatar
 
Join Date: Feb 2006
Location: Ohio
Posts: 93
Rep Power: 3 dr.p is on a distinguished road
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
dr.p is offline   Reply With Quote
Old Feb 24th, 2008, 12:49 PM   #3
slicksk8te
Newbie
 
Join Date: Feb 2008
Posts: 13
Rep Power: 0 slicksk8te is on a distinguished road
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.
slicksk8te is offline   Reply With Quote
Old Feb 24th, 2008, 12:54 PM   #4
slicksk8te
Newbie
 
Join Date: Feb 2008
Posts: 13
Rep Power: 0 slicksk8te is on a distinguished road
Re: Win32 toolbar Programming

Fixed the LPWSTR issue but still does not work.
slicksk8te is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:35 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC