0

I'm currently working on a cross plattform project and I'm pretty new in this subject.

I tried using CommandBar to create a custom toolbar for diverse plattforms. It's working under CE7, Windows Mobile 6 and Windows Mobile 6.5.3. It isn't working under CE6.

The following code is the part which calls up the issue:

const TBBUTTON tbBtns[] = {
        {2, 267, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0},
        {0, 268, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0},
        {1, 269, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0},
        {3, 270, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0},
    };  
    HWND hWndCB = CommandBar_Create(_AtlBaseModule.m_hInst, m_hWnd, 208);

    CommandBar_AddBitmap(hWndCB, _AtlBaseModule.m_hInst, IDB_BTNS, 4, 16, 16);


    CommandBar_AddButtons(hWndCB,4,tbBtns);

    CommandBar_Show(hWndCB, TRUE);

I debugged the program with a CE6 device and I got a toolbar with four empty buttons. When I used GetLastError() after CommandBar_Create(), I got following system error code:

ERROR_CALL_NOT_IMPLEMENTED 120 (0x78)

This function is not supported on this system.

I don't understand why this function shouldn't be supported on CE6. In MSDN library the method is defined as a WINCE function.

Can someone explain me how to solve this problem? Otherwise I would also accept different ways to create a toolbar for CE6, CE7 and Windows Mobile.

Thanks in advance!

1 Answers1

0

CommandBar_Create returns NULL or a valid handle? If you see a bar on your screen I suppose the latter, so checking error code is not useful. A successful function call usually does not reset the value returned by GetLastError. If buttons are empty, check that the bitmap you use for them is linked to the exe and it's in a compatible format.

Valter Minute
  • 2,177
  • 1
  • 11
  • 13
  • CommandBar_Create, as all CommandBar functions, returns a success note. I can see the bar on my screen. The action behind the buttons also working perfectly. I think the same, that the problem is with the bitmap, but everything is linked correctly and it is in a correct 16x16 pixel format. The same code is working for windows mobile 6 and 6.5.3., but not for CE6... – user3374682 Mar 06 '14 at 08:50
  • Did you check the bitmap format (color depth etc.)? Opening your .exe file in VS should allow you to see if the resources are correcly embedded in the executable file. – Valter Minute Mar 06 '14 at 13:23