
Passing pointers to C++ ActiveX controls in VB
You didn't tell the wizard what the parameter was. You'll need to modify
the IDL by hand to say:
void getinfo([in, out] single* info);
I believe. Then recompile the COM object and try it again in VB.
As for Arrays, yes, however, it's not as easy as you'd hope. (i.e. the code
above is not the right first step.) If it's pure VB (not VBScript), I
believe you can get away with:
void getmoreinfo([out, in] long * psizeInOut, [out, size_is(*psizeInOut)]
single arrayOut[]);
However, I'm not 100% sure that will work, and it's definitely not
recommended.
The "right" way to do it is with a SAFEARRAY, but that's a complicated topic
in and of itself:
void getsafeinfo([out,retval] VARIANT* info);
where the Variant contains the SAFEARRAY. FWIW, I highly recommend picking
up a book on this topic. Which book depends on whether you're using ATL or
MFC or coding this stuff manually.
One final topic, you might try the following newsgroups for COM stuff.
You'll get a little better response to these types of questions:
microsoft.public.vc.mfcole (If you're using MFC to write your ActiveX
stuff)
microsoft.public.vc.activex.templatelib (If you're using ATL to write your
ActiveX stuff)
microsoft.public.win32.programmer.ole (Generic COM group)
HTH
--
Reginald Blue | Opinions expressed here do not
Natural Language Understanding | necessarily represent those of
Unisys Corporation | my employer.
|-------------------------------
| My email address is wrong, you
Quote:
>The method is not defined as you mentioned.
>In the COM/OLE object viewer, both for the ocx and the type lib it is
>defined as ;
>void getinfo(single* info);
>I added a method using the class wizard. Could that be the problem ?
>In that case how should I declare in VC a method for my activeX which would
>be able to change the values of its given parameters ?
>Same kind of question : Can a VC method in an activeX control return an
>"array" which could be used in VB ? how ?
>Thanks.
>Ludovic Launer