heres the code from sdk documentation:
Code: Select all
HWND WINAPI CreateRebar(HWND hwndOwner)
{
   REBARINFO     rbi;
   REBARBANDINFO rbBand;
   RECT          rc;
   HWND   hwndCB, hwndTB, hwndRB;
   DWORD  dwBtnSize;
   INITCOMMONCONTROLSEX icex;
   
   icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
   icex.dwICC   = ICC_COOL_CLASSES|ICC_BAR_CLASSES;
   InitCommonControlsEx(&icex);
   hwndRB = CreateWindowEx(WS_EX_TOOLWINDOW,
                           REBARCLASSNAME,
                           NULL,
                           WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|
                           WS_CLIPCHILDREN|RBS_VARHEIGHT|
                           CCS_NODIVIDER,
                           0,0,0,0,
                           hwndOwner,
                           NULL,
                           g_hinst,
                           NULL);
   if(!hwndRB)
      return NULL;
   // Initialize and send the REBARINFO structure.
   rbi.cbSize = sizeof(REBARINFO);  // Required when using this
                                    // structure.
   rbi.fMask  = 0;
   rbi.himl   = (HIMAGELIST)NULL;
   if(!SendMessage(hwndRB, RB_SETBARINFO, 0, (LPARAM)&rbi))
      return NULL;
   // Initialize structure members that both bands will share.
   rbBand.cbSize = sizeof(REBARBANDINFO);  // Required
   rbBand.fMask  = RBBIM_COLORS | RBBIM_TEXT | RBBIM_BACKGROUND | 
                   RBBIM_STYLE | RBBIM_CHILD  | RBBIM_CHILDSIZE | 
                   RBBIM_SIZE;
   rbBand.fStyle = RBBS_CHILDEDGE | RBBS_FIXEDBMP;
   rbBand.hbmBack = LoadBitmap(g_hinst,
                              MAKEINTRESOURCE(IDB_BACKGRND));   
   // Create the combo box control to be added.
   hwndCB = CreateComboBox(hwndRB);
   // Set values unique to the band with the combo box.
   GetWindowRect(hwndCB, &rc);
   rbBand.lpText     = "Combo Box";
   rbBand.hwndChild  = hwndCB;
   rbBand.cxMinChild = 0;
   rbBand.cyMinChild = rc.bottom - rc.top;
   rbBand.cx         = 200;
   
   // Add the band that has the combo box.
   SendMessage(hwndRB, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand);
   
   // Create the toolbar control to be added.
   hwndTB = CreateToolbar(hwndOwner, dwStyle);
   
   // Get the height of the toolbar.
   dwBtnSize = SendMessage(hwndTB, TB_GETBUTTONSIZE, 0,0);
   // Set values unique to the band with the toolbar.
   rbBand.lpText     = "Tool Bar";
   rbBand.hwndChild  = hwndTB;
   rbBand.cxMinChild = 0;
   rbBand.cyMinChild = HIWORD(dwBtnSize);
   rbBand.cx         = 250;
   // Add the band that has the toolbar.
   SendMessage(hwndRB, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand);
   return (hwndRB);
}
and heres my code:
Code: Select all
If OpenWindow(0,100,100,500,200,#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_SizeGadget, "rebar test")
  
  rbi.REBARINFO
  rbband.REBARBANDINFO
  rc.RECT
  hwndCB.l
  hwndTB.l
  hwndRB.l
  dwBtnSize.w
  icex.INITCOMMONCONTROLSEX
  
  icex\dwSize = SizeOf(INITCOMMONCONTROLSEX);
   icex\dwICC   = #ICC_COOL_CLASSES|#ICC_BAR_CLASSES
   InitCommonControlsEx_(@icex)
   hwndRB = CreateWindowEx_(#WS_EX_TOOLWINDOW, "ReBarWindow32",NULL,#WS_CHILD|#WS_VISIBLE|#WS_CLIPSIBLINGS|#WS_CLIPCHILDREN|#RBS_VARHEIGHT|#CCS_NODIVIDER,0,0,0,0,WindowID(),NULL,GetModuleHandle_(null),NULL)
   
   
   If hwndrb = 0
    errormsg("create rebar")
    End
   EndIf
   
   ;// Initialize And send the REBARINFO Structure.
   rbi\cbSize = SizeOf(REBARINFO)   ;// Required when using this
                                    ;// Structure.
   rbi\fMask  = 0
   rbi\himl   = NULL
   If SendMessage_(hwndRB, #RB_SETBARINFO, 0, @rbi) = 0
    errormsg("send rbi")
    End
   EndIf
   
   ;// Initialize Structure members that both bands will share.
   rbBand\cbSize = SizeOf(REBARBANDINFO);  // Required
   rbBand\fMask  = #RBBIM_COLORS | #RBBIM_TEXT | #RBBIM_BACKGROUND |#RBBIM_STYLE | #RBBIM_CHILD  | #RBBIM_CHILDSIZE |#RBBIM_SIZE
   rbBand\fStyle = #RBBS_CHILDEDGE | #RBBS_FIXEDBMP;
   ;rbBand\hbmBack = LoadBitmap(GetModuleHandle_(0), MAKEINTRESOURCE(#IDB_BACKGRND))   
   
   CreateGadgetList(hwndrb)
   ComboBoxGadget(2, 0,0,100,20)
   AddGadgetItem(2, -1, "uno")
   ;// Create the combo box control To be added.
   hwndCB = GadgetID(2)
   ;// Set values unique To the band with the combo box.
   GetWindowRect_(hwndCB, @rc)
   rbBand\lpText     = @"Combo Box"
   rbBand\hwndChild  = hwndCB
   rbBand\cxMinChild = 0
   rbBand\cyMinChild = rc\bottom - rc\top
   rbBand\cx         = 200
   
   ;// Add the band that has the combo box.
   SendMessage_(hwndRB, #RB_INSERTBAND, -1, @rbBand)
   
   ComboBoxGadget(3, 250,0,100,20)
   AddGadgetItem(3, -1, "due")
   ;// Create the combo box control To be added.
   hwndCB2 = GadgetID(3)
   ;// Set values unique To the band with the combo box.
   GetWindowRect_(hwndCB2, @rc)
   rbBand\lpText     = @"Combo Box"
   rbBand\hwndChild  = hwndCB
   rbBand\cxMinChild = 0
   rbBand\cyMinChild = rc\bottom - rc\top
   rbBand\cx         = 250
   
   ;// Add the band that has the combo box.
   SendMessage_(hwndRB, #RB_INSERTBAND, -1, @rbBand)
   
;{ following bit dont work, couldnt get it to compile!   
;// Create the toolbar control To be added.
   ;hwndTB = CreateToolbar_(0, WindowID())
   
   ;// Get the height of the toolbar.
   ;dwBtnSize = SendMessage_(hwndTB, #TB_GETBUTTONSIZE, 0,0)
   
   ;// Set values unique To the band with the toolbar.
   ;rbBand\lpText     = "Tool Bar"
   ;rbBand\hwndChild  = hwndTB
   ;rbBand\cxMinChild = 0
   ;rbBand\cyMinChild = HIWORD(dwBtnSize)
   ;rbBand\cx         = 250
   ;// Add the band that has the toolbar.
   ;SendMessage_(hwndRB, #RB_INSERTBAND, -1, @rbBand)
;}
   
  Repeat
    event = WaitWindowEvent()
    If event = #PB_Event_CloseWindow
      quit = 1
    ElseIf event = #PB_Event_SizeWindow
      MoveWindow_(hwndrb, 0,0,WindowWidth(), 30, #True)
    EndIf
  Until quit = 1
EndIf
if u take out the bit with the 2nd combo gadget, it works fine..... (resizing window width)