Access to .NET Controls properties (in runtime mode) ??

  • Thread starter Thread starter Alberto Frantini
  • Start date Start date
A

Alberto Frantini

Hi,
I want to write a program like (spy++) which look .Net controls and get
their "Name" property.

Can I do it ? Is any API available for example in the MSCORELIB that can
provide this ?

thx for help!
 
Sorry, I accidentally replied to the user instead of the group. Here was my
response:

First, you will need to capture the mouse so that you receive mouse input
even though you move the stylus over another window.

Second, you will need to use the Win32 WindowFromPoint call to find the
handle of the window (control) under the stylus.

Finally, you will use Control.FromHandle to obtain the actual control
reference. From there, you can read any property you wish.

Caveat 1: ControlFromHandle is probably only available in the Compact
Framework 2.0.

Caveat 2: There is a chance this may not work between two separate
applications, which is probably what you're trying to do. It seems to me
that obtaining a reference to a control in another AppDomain would require
cross-process remoting, and remoting is entirely absent from the Compact
Framework.

I suppose it's worth a try, though. Maybe this will point you in the right
direction.

Jared

After sending the response, however, I realized that Control.FromHandle does
not exist on the Compact Framework (even in version 2.0). I've asked if
they're going to support it before release... *sigh*
 
Back
Top