CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2002
    Posts
    1,417

    ActiveX method return types

    I'm writing an MFC ActiveX control with eVC++ 3.0 (very similar to VC++ 6.0). I want one of the exposed methods to return a void* pointer, but it is not in the list of return types. M$'s CListBox has a method GetItemDataPtr() that returns void* -- anyone know how to do that? I tried just changing the return type from standard BSTR to void* but that didn't work (the ActiveX control compiled without error, but when I added the control to a project, the .h file that was produced has a comment

    // method 'SetItemDataPtr' not emitted because of invalid return type or parameter type

  2. #2
    Join Date
    May 2004
    Posts
    45

    Re: ActiveX method return types

    "void*" is not an "Automation" type.
    You can try returning a Long, that a VB program can use as a "opaque handle".
    Remember: the main consumers of ActiveX controls are VB programs, that have no concept of pointers, so they can use only a few chosen types that map directly into their types - for instance, VB String is Automation BSTR, VB Long is Automation LONG, VB Integer is Automation SHORT, VB Variant is Automation VARIANT, the array types are Automation SAFEARRAY, and so on.

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

Featured