#import "Dnb3.dll"
引用 vb编写的 DNB3.DLL
在此
_Class8000 Ptc8000;
发生以下d3个错误 求教,怎样解决???
e:\program\vc\usevbdll\usevbdlldoc.h(21) : error C2146: syntax error : missing ';' before identifier 'Ptc8000'e:\program\vc\usevbdll\usevbdlldoc.h(21) : error C2501: '_Class8000' : missing storage-class or type specifierse:\program\vc\usevbdll\usevbdlldoc.h(21) : error C2501: 'Ptc8000' : missing storage-class or type specifiers
引用 vb编写的 DNB3.DLL
在此
_Class8000 Ptc8000;
发生以下d3个错误 求教,怎样解决???
e:\program\vc\usevbdll\usevbdlldoc.h(21) : error C2146: syntax error : missing ';' before identifier 'Ptc8000'e:\program\vc\usevbdll\usevbdlldoc.h(21) : error C2501: '_Class8000' : missing storage-class or type specifierse:\program\vc\usevbdll\usevbdlldoc.h(21) : error C2501: 'Ptc8000' : missing storage-class or type specifiers
把dll相应的lib文件加入到工程里
用loadlibrary来导入dll。
4.vc引用vb中ocx和dll
如 C:\TestVb\DBCommon.dll 是个vb做的数据库通用类。包括对表的操作。
在vc中要同时引用 DBCommon.dll和msado15.dll
a>stdafx.h 中加上
#import "C:\Program Files\Common Files\System\Ado\msado15.dll" no_namespace rename("EOF","adoEOF")
#import "E:\backup\Recycled\Study\VB\vb_Report\DBCommon.dll" named_guids(不知道类名用默认,否则用no_namespace 类名)
b>在调用时先要在App中InitInstance
//初始化com类
::CoInitialize(NULL); //用指定命名来定义类型接口指针
::DBCommon::_clsDBCommonPtr pdb;
HRESULT hr=pdb.CreateInstance(DBCommon::CLSID_clsDBCommon);
if(FAILED(hr))
{
AfxMessageBox("Active dll error",MB_ICONINFORMATION);
return false;
}
pdb->PutDBPath(CurrentMoudlePath); //向类中传入数据库存路径
pdb->PutDBPwd((_bstr_t)strpwd); //向类中传入数据库存密码
BSTR bstrNo=_com_util::ConvertStringToBSTR(Mydata->Name.GetBuffer(0));
// BSTR bstrNo=::SysAllocString(L"Q50001");
hr=pdb->Qutation_Print_Transe(&bstrNo);//向类中传入报价单号
pdb.Detach(); //free memory