Board index » cppbuilder » Getting/Passing data types to AxtiveX control

Getting/Passing data types to AxtiveX control

I am trying to find a way to pass a void* (void pointer) from my code in
visual C++ into an ActiveX list control I built with Builder 4.  My control
is based on the Win32 List view component.  In my interface I have
parameters that accept and return void*, however when I compile the ActiveX
control my void* turns into void.  Is there anyway to pass in an unknown
class type to my control and then return it later when I need it?  IO would
like to do this so that other people can associate unknown types of data
with items in my list.

For example I would like to do something like this

Visual C++ side...

class Family
{
    ...
    pirvate:
       Husband hubby;
       Wife spouse;
       Child junior;

Quote
}

class Husband : public person
{
    ...
Quote
}

class Wife : public person
{
    ...
Quote
}

class Child : public person
{
    ...

Quote
}

...

//  Create a new family
Family lewisFamily(Paul, Jana, Curtis);

//  get a void* to the family object
void* associatedData= (void*)lewisFamily

//  associate the family with a list item.
m_AXListControl.setListData(indexOfLine, lineText, associatedData);

...

//  retrieve the data associated with the list item.
lewisFamily = (Family) m_AXListControl.getListData(indexOfLine);

...

 

Re:Getting/Passing data types to AxtiveX control


Paul, I'm not sure I understand what 'void * turns to void' mean :(

Alex

Quote
Paul Lewis wrote:

[snip]

Re:Getting/Passing data types to AxtiveX control


I mean the compiler replaces the void* on my return type with void.  Is it
not legal to have void* as a return type for an ActiveX interface method?

Re:Getting/Passing data types to AxtiveX control


I think that all the methods must return HRESULT. If you need to return
something from a method, you use [out, retval] ( which is something
declared as a pointer ). Just use automation-compatible types ( TLE
lists them all ).

HTH,
Alex

Quote
Paul Lewis wrote:

> I mean the compiler replaces the void* on my return type with void.  Is it
> not legal to have void* as a return type for an ActiveX interface method?

--
HotSend - portable documents technology
http://www.hotsend.com/
eFax - get your faxes via email - Free !
http://www.efax.com

Other Threads