Toolbar exceptions 
Author Message
 Toolbar exceptions

Could anyone help I get the following error when the
TB_ADDBUTTONS message is sent. The toolbar works correctly
and appears right. I get an error for each button. Any
help appreciated, Source corrections even more.
Thanks ahead of time.

My errors for TB_ADDBUTTONS.
First-chance exception in piggy.exe (KERNEL32.DLL):
0xC0000005: Access Violation.
First-chance exception in piggy.exe (KERNEL32.DLL):
0xC0000005: Access Violation.
First-chance exception in piggy.exe (KERNEL32.DLL):
0xC0000005: Access Violation.
First-chance exception in piggy.exe (KERNEL32.DLL):
0xC0000005: Access Violation.

HWND CreateToolBar(HWND hWndParent)
{
    HWND hWndToolBar;      
    TBADDBITMAP tbab;
    TBBUTTON tbb[4];

        hWndToolBar = CreateWindowEx (0,TOOLBARCLASSNAME,
NULL,WS_CHILD |
    TBSTYLE_TOOLTIPS | WS_CLIPCHILDREN | WS_CLIPSIBLINGS |
CCS_NODIVIDER |
        CCS_NORESIZE | WS_VISIBLE ,0,0,0, 0, hWndParent,
(HMENU) ID_TOOLBAR, hInst,NULL);

  SendMessage(hWndToolBar, TB_BUTTONSTRUCTSIZE, (WPARAM)
sizeof(TBBUTTON), 0);

  tbab.hInst = hInst;
  tbab.nID = IDB_TOOLBAR_BITMAP;

  tbb[0].iBitmap = 0;
  tbb[0].fsState = TBSTATE_ENABLED;
  tbb[0].fsStyle = TBSTYLE_BUTTON;
  tbb[0].dwData = 0;
  tbb[0].idCommand = CM_CONNECT_BUTTON;
  tbb[1].iBitmap = 1;
  tbb[1].fsState = TBSTATE_ENABLED;
  tbb[1].fsStyle = TBSTYLE_BUTTON;
  tbb[1].dwData = 0;
  tbb[1].idCommand = CM_DISCONNECT_BUTTON;
  tbb[2].iBitmap = 2;
  tbb[2].fsState = TBSTATE_ENABLED;
  tbb[2].fsStyle = TBSTYLE_BUTTON;
  tbb[2].dwData = 0;
  tbb[2].idCommand = CM_CHECKMAIL_BUTTON;
  tbb[3].iBitmap = 3;
  tbb[3].fsState = TBSTATE_ENABLED;
  tbb[3].fsStyle = TBSTYLE_BUTTON;
  tbb[3].dwData = 0;
  tbb[3].idCommand = CM_CONFIGURATION_BUTTON;

  SendMessage(hWndToolBar, TB_ADDBITMAP,4, (LPARAM)&tbab);
  SendMessage(hWndToolBar, TB_ADDBUTTONS, 4, (LPARAM)&tbb);
  SendMessage(hWndToolBar, TB_AUTOSIZE, 0, 0);

return hWndToolBar;

Quote:
}



Wed, 21 Jan 2004 18:37:30 GMT  
 Toolbar exceptions
Nevermind, forgot to add text string. Always the small
things.
Quote:
>-----Original Message-----
>Could anyone help I get the following error when the
>TB_ADDBUTTONS message is sent. The toolbar works
correctly
>and appears right. I get an error for each button. Any
>help appreciated, Source corrections even more.
>Thanks ahead of time.

>My errors for TB_ADDBUTTONS.
>First-chance exception in piggy.exe (KERNEL32.DLL):
>0xC0000005: Access Violation.
>First-chance exception in piggy.exe (KERNEL32.DLL):
>0xC0000005: Access Violation.
>First-chance exception in piggy.exe (KERNEL32.DLL):
>0xC0000005: Access Violation.
>First-chance exception in piggy.exe (KERNEL32.DLL):
>0xC0000005: Access Violation.

>HWND CreateToolBar(HWND hWndParent)
>{
>    HWND hWndToolBar;      
>    TBADDBITMAP tbab;
>    TBBUTTON tbb[4];

>    hWndToolBar = CreateWindowEx (0,TOOLBARCLASSNAME,
>NULL,WS_CHILD |
>    TBSTYLE_TOOLTIPS | WS_CLIPCHILDREN | WS_CLIPSIBLINGS
|
>CCS_NODIVIDER |
>    CCS_NORESIZE | WS_VISIBLE ,0,0,0, 0, hWndParent,
>(HMENU) ID_TOOLBAR, hInst,NULL);

>  SendMessage(hWndToolBar, TB_BUTTONSTRUCTSIZE, (WPARAM)
>sizeof(TBBUTTON), 0);

>  tbab.hInst = hInst;
>  tbab.nID = IDB_TOOLBAR_BITMAP;

>  tbb[0].iBitmap = 0;
>  tbb[0].fsState = TBSTATE_ENABLED;
>  tbb[0].fsStyle = TBSTYLE_BUTTON;
>  tbb[0].dwData = 0;
>  tbb[0].idCommand = CM_CONNECT_BUTTON;
>  tbb[1].iBitmap = 1;
>  tbb[1].fsState = TBSTATE_ENABLED;
>  tbb[1].fsStyle = TBSTYLE_BUTTON;
>  tbb[1].dwData = 0;
>  tbb[1].idCommand = CM_DISCONNECT_BUTTON;
>  tbb[2].iBitmap = 2;
>  tbb[2].fsState = TBSTATE_ENABLED;
>  tbb[2].fsStyle = TBSTYLE_BUTTON;
>  tbb[2].dwData = 0;
>  tbb[2].idCommand = CM_CHECKMAIL_BUTTON;
>  tbb[3].iBitmap = 3;
>  tbb[3].fsState = TBSTATE_ENABLED;
>  tbb[3].fsStyle = TBSTYLE_BUTTON;
>  tbb[3].dwData = 0;
>  tbb[3].idCommand = CM_CONFIGURATION_BUTTON;

>  SendMessage(hWndToolBar, TB_ADDBITMAP,4, (LPARAM)&tbab);
>  SendMessage(hWndToolBar, TB_ADDBUTTONS, 4, (LPARAM)
&tbb);
>  SendMessage(hWndToolBar, TB_AUTOSIZE, 0, 0);

>return hWndToolBar;
>}
>.



Wed, 21 Jan 2004 18:45:31 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Can't remove toolbar buttons without an unhandled exception

2. Help! Strange First Chance Exception on Toolbar

3. Unhandled exception error in toolbar

4. Can't remove toolbar buttons without an unhandled exception

5. Exception when mouse moves over toolbars!

6. Can't remove toolbar buttons without an unhandled exception

7. Translate a SEH exception into a C++ exception

8. Soap Exception -- Inner Exception

9. Exception gurus - Copy constructors of exceptions

10. Exception with no Exception

11. Crash In Exception Filter in Structured Exception HAndling

12. Catching hardware exceptions using C++ exceptions

 

 
Powered by phpBB® Forum Software