toolStripButton

For some reason the toolStripButtons on a toolstrip don't have a handle when using Spy++. At the same time a toolStripComboBox on a toolStrip has handle.

I am tryign to send a message to the toolStrip buttons but I can't because thre is no handle. Is there a workaround? Why doesn't a toolstripbutton have a handle and a toolstripcombobox does?

Thanks a lot!

[380 byte] By [DanO84] at [2007-12-22]
# 1
That's

because a ToolStrip knows how to paint a menu item (not button) without

having to hand off the job to dedicated Windows control. It

doesn't know how to paint a ComboBox so it gladly creates a combobox

window and lets that control deal with all the nasty details of how to

drop down a list of choices, etc. It is an optimization,

minimizing the number of windows that get created, thus making it more

responsive to the user. It is an optimization that stops you from

cheating the system...

nobugz at 2007-8-30 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 2

nobugz wrote:
That's because a ToolStrip knows how to paint a menu item (not button) without having to hand off the job to dedicated Windows control. It doesn't know how to paint a ComboBox so it gladly creates a combobox window and lets that control deal with all the nasty details of how to drop down a list of choices, etc. It is an optimization, minimizing the number of windows that get created, thus making it more responsive to the user. It is an optimization that stops you from cheating the system...

is there a way to talk to toolStripButtons from another .NET c# application?

DanO84 at 2007-8-30 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 3
anybody?
DanO84 at 2007-8-30 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 4
Maybe this article and code will help...
nobugz at 2007-8-30 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 5
i read the article... it is a good article, and the tool presented there does indeed have the functionality of interprocess communication. The bad thing is that everything it does is based on handles again, and toolstripbuttons dont have a handle consequently, you cant see toolstrip buttons with the mentioned tool.
DanO84 at 2007-8-30 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 6
Managed

Spy has the same problem you do. A button on the ToolStrip is not

a real control, it is just a picture of a button that the ToolStrip

control paints. Same with a label BTW. I don't know what

you're trying to do but if you want to click on the button with your

own program, you could click on the ToolStrip control at the "right"

position...

nobugz at 2007-8-30 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 7
Is your problem solved? Please mark the thread as answered if it is..
nobugz at 2007-8-30 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 8
nope
DanO84 at 2007-8-30 > top of Msdn Tech,Windows Forms,Windows Forms General...