Handle to a window

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • JJ

    #1

    Handle to a window

    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


  • Santastp

    #2
    Re: Handle to a window

    Can you explain is to doing what.
    You question is too large for possible answer!

    "JJ" <jmraz@bellatla ntic.net> wrote in message
    news:%23SjGVQwS DHA.2148@TK2MSF TNGP12.phx.gbl. ..[color=blue]
    > 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
    >
    >[/color]


    Comment

    • Greg Ewing [MVP]

      #3
      Re: Handle to a window

      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?

      --
      Greg Ewing [MVP]



      "JJ" <jmraz@bellatla ntic.net> wrote in message
      news:#SjGVQwSDH A.2148@TK2MSFTN GP12.phx.gbl...[color=blue]
      > 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
      >
      >[/color]


      Comment

      • JJ

        #4
        Re: Handle to a window

        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



        "Greg Ewing [MVP]" <gewing@_NO_SPA M_claritycon.co m> wrote in message
        news:OvZiGfwSDH A.2128@TK2MSFTN GP12.phx.gbl...[color=blue]
        > 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?
        >
        > --
        > Greg Ewing [MVP]
        > http://www.claritycon.com/
        >
        >
        > "JJ" <jmraz@bellatla ntic.net> wrote in message
        > news:#SjGVQwSDH A.2148@TK2MSFTN GP12.phx.gbl...[color=green]
        > > 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
        > >
        > >[/color]
        >
        >[/color]


        Comment

        Working...