Passing pointer into ActiveX control?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Passing pointer into ActiveX control?

  1. #1
    Join Date
    Mar 2004
    Posts
    100

    Passing pointer into ActiveX control?

    I'm writing an ActiveX control. In one of the functions I'd like the user to be able to pass me a pointer to a buffer that they created which I can then fill with data and return a success/error code. What's the appropriate way to do this? I was thinking about just using an OLE_HANDLE type for the parameter and then casting that to pointer inside the OCX but I'm not sure if that's safe or the right way to do it. Any suggestions or advice?

    Thanks,
    Dan

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,352

    Re: Passing pointer into ActiveX control?

    Never tried it myself, but perhaps it could help: http://forums.ni.com/t5/Measurement-...sual/td-p/9218
    Victor Nijegorodov

  3. #3
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    5,957

    Re: Passing pointer into ActiveX control?

    Quote Originally Posted by Dan203 View Post
    I'm writing an ActiveX control. In one of the functions I'd like the user to be able to pass me a pointer to a buffer that they created which I can then fill with data and return a success/error code. What's the appropriate way to do this? I was thinking about just using an OLE_HANDLE type for the parameter and then casting that to pointer inside the OCX but I'm not sure if that's safe or the right way to do it. Any suggestions or advice?
    The safety will depend on the details of your control implementation, but typically it's fine unless it to implement a marshaling of some special type. As well, passing low level pointers will most probably limit your clients to C/C++/Delphi.

    Actually, COM has a couple of special mechanisms adapted specifically to passing byte chains: IStream and Safe Array.
    Best regards,
    Igor

Posting Permissions

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


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center