However, what if I want to do this across an application with hundreds of
buttons? I have a component that, for each class, when a button has focus
and a specific hardware key is KeyDown'ed on it, I trap that event. Great,
I have the button's properties. I can't click it! I've tried P/Invoking
mouse_event with the button's absolute coordinates, but it merely passes a
WM_LBUTTONDN to the parent window, getting me no where. If I start using
WM_COMMAND, then I assume I need a WindowsCE.Forms.MessageWindow object
sitting inside each form, which I am trying to avoid.
Perhaps the OpenNET folks have come up with something useful in this
department. mouse_event is failing me . . .
--
_________________________________
Jared Miniman
Accenture Mobile Solutions Group
MethodInfo method = typeof(Control).GetMethod("OnClick",
BindingFlags.NonPublic | BindingFlags.Instance);
method.Invoke(button1, new object[]{EventArgs.Empty});
If you want to do this alot in your app then store the method info and reuse
it calling invoke with any button (or any class derived from Control).
mouse_event should also work, but the co-ordinate system requires you to
specify the co-ordinates in a scale from 0 to ffff in each direction. also
you'll need to call it twice once with left button down and again with a
left button up.
Peter
--
Peter Foot
Windows Embedded MVP
http://www.inthehand.com | http://blog.opennetcf.org/pfoot/
"Jared Miniman" <po...@tothenewsgroup.thx> wrote in message
news:u9H$cvzKFH...@tk2msftngp13.phx.gbl...
That's clever! Didn't think about using reflection, though as a general
practice, I shy away from using it. I actually got my code working by doing
something super simple: I grab the handle to the button control (made easy
by GetFocus in OpenNETCF Win32Window; we only care about focused buttons)
and the send an empty WM_LBUTTONDN/UP message to it.
Appreciate the help.
--
_________________________________
Jared Miniman
Accenture Mobile Solutions Group
"Peter Foot [MVP]" <feed...@nospam-inthehand.com> wrote in message
news:%23bQrk80...@TK2MSFTNGP12.phx.gbl...