Results 1 to 4 of 4

Thread: UserControl and hWnd

  1. #1

    Thread Starter
    PowerPoster BruceG's Avatar
    Join Date
    May 2000
    Location
    New Jersey (USA)
    Posts
    2,657
    A while back I created an ActiveX control that is basically an enhanced textbox. I have been using it for a while and have had no problems. Now, I want to use a SendMessage API on it, but wouldja believe it has no hWnd property. What modifications would have to make in my AX control project to let this thing have an hWnd property? TIA.
    "It's cold gin time again ..."

    Check out my website here.

  2. #2
    Lively Member
    Join Date
    Feb 2001
    Location
    Malaysia
    Posts
    71
    Create an hWnd property as usual, setting its value to the hWnd of the textbox control.

  3. #3
    Hyperactive Member Wak's Avatar
    Join Date
    Nov 2000
    Location
    Brisbane, Queensland
    Posts
    298

    Umm are you using api or the normal vb view?

    If your using API, then you can just pass the handle as the HWND property, else not just use Text1.hWnd and use a Long variable to hold it.

    I love reapeating other ppl.
    Visual Basic 6.0 Enterprise
    Visual C++ 6.0 Professional

    Wak

  4. #4
    Fanatic Member
    Join Date
    Jun 1999
    Location
    California, USA
    Posts
    662
    Actually, if it's a UserControl, then is already has an hWnd. Just make a new property like so:

    Code:
    Public Property Get hWnd() As Long
        hWnd = UserControl.hWnd
    End Property
    (No need for a Property Let, as this propertyy is always readonly)

    If you are defining a set of you own special messages (WM_USER through WM_USER + &h7BFF) then you'll need to subclass the usercontrol from within the usercontrol project (or a subclasser control) to look for those messages.

    Dang, I just went off on another tangent. Sorry. See ya next time you got a question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width