>I've got a COM object built (building a debug version of the DLL) from VC++ and trying to use it in VFP.
>
>1) Is it possible to set breakpoints in the VC debugger and have them triggered when VFP calls the method? I can attach VFP as a process in the VC debugger but the breakpoints don't trigger. I know this works great if the VC component is a plain API DLL but it looks like a COM DLL works differently.
>
Yes. Just set the startup program to VFP.EXE and build your VC code with debug settings, then run the project. It'll start VFP and stop on your breakpoints.
>2) How can I clear the DLL from memory? Once VFP instantiates the COM VC can not rebuild the DLL until I completely shutdown VFP.
You'll have to exit VFP. Again the scenario above does the trick.
>
>3) The COM methods are returning HRESULT values and VFP is for some reason converting them to empty strings:
Does the object support IDispatch? Otherwise VFP can't call these or it will get invalid values back.
>
>lnResult = ox.Method()
>? type( "lnResult" ) && "C" and not N
>
Every IDispatch method must return an HRESULT. Return values are passed
back via OUT (MIDL) parameters in COM objects.
>4) How can I declare the COM method to take a BSTR string argument by reference so it can be an OUT or INOUT parameter. Just declaring the argument as BSTR doesn't let the method alter a variable passed by reference from VFP.
You need to set it up as a pointer to a BSTR (double reference) and then mark it as [IN,OUT].