CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Threaded View

  1. #1
    Join Date
    Jun 2011
    Posts
    6

    Unable to add custom icon / bitmap to command bar - WinCE 5 API

    I am able to add system icons to a command bar, but when I try to add my own, I just get a blank button. I have tried several configurations, a bitmap vs. an icon, and it still shows up as blank. Since I was testing with a system icon, that code is commented out.

    Here is my button structure:

    Code:
    // File bar button structure
    const TBBUTTON tbCBStdBtns[] = 
    {
    //  BitmapIndex       Command    State       Style       UserData String
    //	{STD_FILENEW,     IDC_NEW,   TBSTATE_ENABLED,
    //                                         TBSTYLE_BUTTON,    0,   0},
    	{IDB_SQUARED16, IDC_SQUAREDSHIPPING, 
    								TBSTATE_ENABLED, TBSTYLE_BUTTON,    0,   0}
    };
    
    Here is the creation:
    
    case WM_CREATE:
    			// Create the command bar
    			g_hWndCommandBar = CommandBar_Create(g_hInst, hWnd, IDC_CMDBAR);
    			CommandBar_AddBitmap (g_hWndCommandBar, g_hInst, IDB_SQUARED16, 1, 0, 0);
    			//CommandBar_AddBitmap (g_hWndCommandBar, HINST_COMMCTRL, IDB_STD_SMALL_COLOR, STD_BMPS, 0, 0);
    			CommandBar_AddButtons(g_hWndCommandBar, 1, &tbCBStdBtns);
    			//CommandBar_AddButtons(g_hWndCommandBar, 1, &tbCBStdBtns);
                CommandBar_InsertMenubar(g_hWndCommandBar, g_hInst, IDR_MENU, 1);
    Note that I want the icon to the left of the menu (originally I wanted the icon on the title bar, but apparently it is not supported in WinCE). I'm pretty new at this, so I apologize in advance if my code inclusion does not follow this website's standards. I will certainly provide the files if necessary.

    Thanks in advance!
    Last edited by MasterWill; July 1st, 2011 at 02:15 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured