1

I have created a toolbar with some controls on it using ReBar within a window. Can anyone please tell me,

  1. How to get the HWND of a buttons/combobox/etc (not normal buttons in a window) if I know (only) the Id of it ?
  2. How to obtain the HBITMAP if I know the id of the resource ?
  3. How to set the bitmap to the controller ?

    SendDlgItemMessageW(hWnd, nId, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hBitmap);

This isn't working for toolbars, isn't it ? I couldn't find a way to do it, please help me. Thank you...

Regards

EDIT: Anyone please ? :(

EDIT: Ok. it seems everyone is busy these days. :( Btw, is it a wrong question ?

Morpheus
  • 1,722
  • 5
  • 27
  • 38
  • What do you mean by controller? a rebar band? – Alex K. Apr 16 '10 at 13:10
  • Hey! Anything in a rebar such as Button, Combobox, etc. (I didn't have any other word to describe it). Thanks. – Morpheus Apr 16 '10 at 14:55
  • I thought that a rebar control contains one or more rebar bands, and that a rebar band could only contain one control. See http://msdn.microsoft.com/en-us/library/bb774373(VS.85).aspx. Could you please elaborate on what you mean in the lanuage of this MSDN article? – Andreas Rejbrand Apr 16 '10 at 16:06
  • Hey! I just know that to create the toolbar, it used rebar CONCEPT (Actually I don't know further details). So, I have ids for every buttons in toolbar, HWND for rebar and toolbar window. Now I have to change the bitmap of a button (in the toolbar) using this knowledge. Can I do it ? – Morpheus Apr 16 '10 at 16:15

2 Answers2

1

You could download ControlSpy and try it in there to get a feel for it.
I checked the Rebar and saw that RB_SETBANDINFO (under Messages) could be what you are looking for.

default
  • 11,485
  • 9
  • 66
  • 102
0

GetDlgItem will work just as well with a Rebar as it does with a Dialog.

You can use the GetDlgItem function with any parent-child window pair, not just with dialog boxes. As long as the hDlg parameter specifies a parent window and the child window has a unique identifier (as specified by the hMenu parameter in the CreateWindow or CreateWindowEx function that created the child window), GetDlgItem returns a valid handle to the child window.

You can use LoadImage to load a bitmap from a resource and return the HBITMAP.

Finally, SendMessage(hWndButton, BM_SETIMAGE, (WPARAM) IMAGE_BITMAP, (LPARAM) hBitmap);

Mark Ransom
  • 299,747
  • 42
  • 398
  • 622