Handle to a window

  • Thread starter Thread starter JJ
  • Start date Start date
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
 
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?
 
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
 
Back
Top