tags:

views:

161

answers:

1

I have the handle of a window in an external application, This window has a control type ToolbarWindow32. is possible add a button (or item) in this ToolbarWindow32 control using delphi.

i found a similar sample (This tool allows to alter the order of the window buttons in a ToolbarWindow32) in this link http://www.codeproject.com/KB/shell/taskbarsorter.aspx but using c#.

A: 

May be TB_INSERTBUTTON message is usefull for you. (I must say that: I've never try this code.)

you can find more info about TB_INSERTBUTTON here and about TBButton type here

var
  HandleToolbarWnd: HWND;
  BtnInfo: TTBButton;
begin
  //prepare your BtnInfo
  HandleToolbarWnd:= FindWindowEx(ParentWndHandle, 0,    'ToolbarWindow32', nil);
  SendMessage(HandleToolbarWnd, TB_INSERTBUTTON, IndexOfBtn, LParam(@BtnInfo));
SimaWB
Sending messages to a window in another application doesn't work if pointers to memory are involved, since the address space is different. Marshalling is needed, which Windows does for a few messages (like `WM_GETTEXT`), but which needs to be done here manually.
mghie