Results 1 to 4 of 4

Thread: ocx hWnd

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2000
    Location
    Brisbane Australia
    Posts
    3

    Question

    I need to get the hWnd of my UserControl. The property is not exposed even if I change the "Parent" or "Windowless" properties it seems. I need to be able to get the hWnd for each instance of my ocx to pass to the API "SetTimer" function. Currently I am using a third party control to achieve this, but don't want it in my finished ocx. I would dearly love someone to enlighten me on this, and I thank you in advance

  2. #2
    Guest

    had the same problem too...

    ... this helped me
    Code:
    Public Property Get hWnd() As Long
        hWnd = UserControl.hWnd
    End Property
    Just insert this in your UserControl's code.

    The UserControl MUST NOT be windowless in order to have a window handle.

    Regards
    da_bob
    ______________

  3. #3

    Thread Starter
    New Member
    Join Date
    Sep 2000
    Location
    Brisbane Australia
    Posts
    3

    Thanks

    I had tried that da_Bob but it didn't work, it simply recurses into a stack overload. I've tried changing the container property, and with "Windowless" as true, and when that wouldn't work I tried it false. For some reason it won't expose the hWnd. I have heard of this problem before but never did find the solution, but now I am in need of it. I'm wondering if "GetWindow" may be the answer, but if so, and how, I don't know, though I'd love someone to enlighten me
    Thank you da_Bob anyway.

  4. #4

    Thread Starter
    New Member
    Join Date
    Sep 2000
    Location
    Brisbane Australia
    Posts
    3

    Thank you

    da_bob you were %100 correct. I added the instance num as in "UserControl1" and strangely it didn't work.
    Thank you very much indeed
    regards
    morgo

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