Results 1 to 3 of 3

Thread: calling methods using hWnd

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2001
    Location
    Egypt
    Posts
    179

    calling methods using hWnd

    Hello,

    I made two ActiveX controls, I want to call some methods in one ocx from
    the other using its hWnd property. How can I do that?

    thanks,
    Belal

  2. #2
    Lively Member
    Join Date
    Jul 2000
    Location
    Sydney, Australia
    Posts
    74
    As I understand it, the ocx file is the compiled version of your control which acts pretty much like a dll. hWnd is a handle (effectively a pointer) to a particular instance of a window of a particular class. (Window in this case means pretty much any distinct area of the screen rather than Form)

    So what you are asking doesn't really make sense from my perspective. You may be able to import the function/method using the Declare statement and use it that way, but I don't think that it would involve hWnd.

    Anyway thats my 2 cents worth.

  3. #3
    jim mcnamara
    Guest
    I think you believe that
    1. your controls are Window class objects, and they have a HWnd
    2. you can therefore call EnumChildWindows get the hWnd and mess with the window.

    If you are sublassing your control inside of your OCX, you can use SendMessage with a user-defined message, have your homegrown version of WndProc do something with it. But why bother? You wrote the control, so you got to design the interface, so use it. OR change it to meet your needs.

    But Amcrae is right - a hWnd never exposes a COM interface, just the standard Windows messaging. Expecting it to expose methods/properties as an interface is something that cannot happen. Goes against COM rules. Completely.

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