Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Fatal error c1083 cannot open precompiled header file
Message
General information
Forum:
Visual C++
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00737936
Message ID:
00740419
Views:
43
Hi!, when you have 3 parameters you need pass the same with variant array, and is too complex, instead you can use 1 or 2 parameters.

now i dev a fox com with VC++ and don't have troubles, here is the code i use:

CoInitialize(0);
_variant_t vResult;
CString strCurrentDirectory = AfxGetApp()->m_pszHelpFilePath;
HRESULT hr;
CComDispatchDriver oServer;
CComPtr lpTDispatch;
CObizApp *pMyApp = (CObizApp *)AfxGetApp();
CString ccomapp = pMyApp->getcomapp(); <--- here obtain the string of the com object: like "foxapp.myfunction"
hr = 0;
hr = lpTDispatch.CoCreateInstance(_bstr_t(ccomapp));
if ( FAILED(hr) )
{
//goto Exit; // Un error ocurrio!!
}
oServer = lpTDispatch;
strCurrentDirectory = strCurrentDirectory.Left( strCurrentDirectory.ReverseFind( '\\') + 1);

here with 2 parameters:

hr = oServer.Invoke2(_bstr_t("RegisterUser"),&_variant_t(m_id),&_variant_t(m_password),&vResult);
if (vResult.boolVal)
{
CObizApp *pMyApp = (CObizApp *)AfxGetApp();
//pMyApp->registeruser(m_id,m_password);
//getp2pconfig(strCurrentDirectory);
//vResult.r

here with 1 parameter:
oServer.Invoke1(_bstr_t("setp2pPath"),&_variant_t(strCurrentDirectory),&vResult);
if (vResult.boolVal)
{
more 2 parameters examples
oServer.Invoke2(_bstr_t("getp2pNetwork"),&_variant_t(m_id),&_variant_t(m_password),&vResult);
oServer.Invoke2(_bstr_t("getp2pUsers"),&_variant_t(m_id),&_variant_t(m_password),&vResult);
}
//CoUninitialize();
ShowWindow(SW_HIDE);
CDialog::OnOK();
}
else
{
AfxMessageBox ("user or password invalid");
//CoUninitialize();
}

thanks work fine for me, now i using VC++ 6.0 sp5 without troubles and the component work with SAP DB Database for backend and all work fine to now.

Regards

Francisco Morosini

about pre-compiler need rebuild any time you modify StdAfx.h because for performance reason exist a precompiled header for each header, work with precompiler (is better).

>>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.
Previous
Reply
Map
View

Click here to load this message in the networking platform