>Paul,
>
>Thank you for the info. I am picking up where David left off and am also a C++ novice trying to invoke the VFP COM object. David was able to resolve the initial compile error, however, I'm now getting the following errors when I try compile:
> error C2660: 'm_set' : function does not take 3 parameters
> error C2660: 'm_get' : function does not take 2 parameters
>
>I am getting this error for every VFP method being invoked, even though m_get() has 3 parameters defined, etc. Any suggestions? I've looked at the Rick Strahl article and it isn't obvious what we're doing wrong. Here's the first part of VFP m_set:
>Function m_set
> Lparameters tcPropName,tuPropValue,tcType
You might already have this working, but even if you do, maybe this will help someone else. I played with this a little while ago and it appears that VFP doesn't create a proper .TLB file when defining your methods in code.
For example:
FUNCTION Method
LPARAMETERS tcValue
* Do something
ENDFUNC
This method takes one parameter, tcValue. However, the TLB created by VFP doesn't show ANY parameters. Because VC++ imports the type library created by VFP, it (incorrectly) finds a method that doesn't have any parameters (which is where your error is coming from).
If you change the code to this instead:
FUNCTION SomeMethod(tcValue)
* Do something
ENDFUNC
The generated TLB is correct and VC++ will stop complaining.
This appears to be the case in both VFP 7 and the public VFP 8 beta.