Hi,
How can I get all the button from toolbar and press the button?
I had using TB_BUTTONCOUNT to count got how many button inside my toolbar.
The result return to me is correct.
string sNotifyIconClass = "NotifyIconOverflowWindow";
hwndNotify = FindWindow(sNotifyIconClass, null);
hwndNotifyChild = FindWindowEx((IntPtr)hwndNotify, IntPtr.Zero, "ToolbarWindow32", null);
Int32 iCount = Convert.ToInt32(SendMessage((int)hwndNotifyChild,TB_BUTTONCOUNT,0,IntPtr.Zero));
However, I can't retrieve each of the button inside the toolbar by using TBBUTTONINFO.
TBBUTTONINFO[] buttons = new TBBUTTONINFO[iCountItem];
for (int k = 0; k < iCountItem; k++)
{
TBBUTTONINFO ti = new TBBUTTONINFO();
ti.dwMask = TBIF_BYINDEX | TBIF_TEXT;
ti.cbSize = (uint)Marshal.SizeOf(ti);
SendMessage(new HandleRef(null, hwndChild), TB_GETBUTTONINFO, (IntPtr)k, ref ti);
buttons[k] = ti;
Int32 iCount = SendMessage((int)hwndChild, TB_PRESSBUTTON, 0, IntPtr.Zero);
}
Please help. Thanks in advanced.