Handle to a window

J

JJ

Hi All,

How can I get the handle to a window in c#? I did notice that for a
form in C# there is a hwnd property, is this one and the same?

Thanks,

JJ
 
G

Greg Ewing [MVP]

JJ, you can use the Handle property which is inherited from the Control
class, it is a windows handle. What hwnd property are you referring to?
 
J

JJ

Ok so if I have a user control and I need its handle I would refer to in the
following manner:

uint hWnd = usercontrolName.Handle();

Correct?

An article mentioned that you can't get a handle to a window outside your
app but have to use IntPtr instead.

See I am trying to get a handle to a usercontrol and pass it into an API
call.

JJ
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top