Hi ctacke
This is exactly what i have done already.
I loop around the a form from an App that is running in a different
process. I have created a class called Window and I create an instance
of the window class for every control on the form.
The Window class has 3 properties Handle, Caption and ClassName.
The problem is that when I have 2 ComboBox's they have neither of them
have a Caption so I have no way to tell them apart.
I am trying to find some why of getting at some other human readable
property or piece of information that is always the same(the problem is
that Handles keep changing). I cant seem to fined any way of
distinguishing between the 2 ComboBox's
I thought if I could convert it to a control I might have access to a
Name property. Both Applications are written in CF2.0
Any idea's?
Thanks,
ink
"<ctacke/>" <ctacke[at]opennetcf[dot]com> wrote in message
Indeed. It's not supported in the CF, and if it were, it still won't
turn a handle from outside your managed app's scope of resources into a
Control. That said, you could still create your own wrapper that takesn
in a Handle and then exports things like Text by wrapping the necessary
P/Invoke calls.
--
Chris Tacke, Embedded MVP
OpenNETCF Consulting
Managed Code in an Embedded World
www.OpenNETCF.com
Bollocks..
ink wrote:
If I have a Windows 32 pointer to and object (Handle) and I know
what that object is (Button) can I some how cast that pointer to a
type of System.Windows.Forms.Button and then use its methods and
properties?
Yes.
For example:
Button ButtonFromHandle(IntPtr handle)
{
return Control.FromHandle(handle) as Button;
}
This will return a Button instance reference if the handle is valid
and represents a Button control, or null if not.
Pete