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
Re: Passing pointer into ActiveX control?
Re: Passing pointer into ActiveX control?
Quote:
Originally Posted by
Dan203
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.