|
我把creo4.0的otk和protoolkit库文件动态库文件全部都加进VS2015的配置的附加依赖库了
otk_cpp_md.lib
otk_222_md.lib
otk_no222_md.lib
otk_cpp_async_md.lib
protk_dllmd_NU.lib
protkmd_NU.lib
pt_asynchronous.lib
ptasyncmd.lib
ucore.lib
udata.lib
netapi32.lib
wsock32.lib
psapi.lib
mpr.lib
ws2_32.lib
代码是creo本身自带的,用它的代码打开编译就没有问题,换成我自己创建的MFC-DLL就报错。我查看了它的代码是用windows标准库,但是我改成windows标准库也不行。
BEGIN_MESSAGE_MAP(CMyMDSApp, CWinApp)
END_MESSAGE_MAP()
// CMyMDSApp 构造
CMyMDSApp::CMyMDSApp()
{
// TODO: 在此处添加构造代码,
// 将所有重要的初始化放置在 InitInstance 中
}
// 唯一的一个 CMyMDSApp 对象
CMyMDSApp theApp;
// CMyMDSApp 初始化
BOOL CMyMDSApp::InitInstance()
{
CWinApp::InitInstance();
return TRUE;
}
static ofstream logFile;
class OTKTestCallBack : public virtual pfcUICommandActionListener
{
public:
void OnCommand();
};
/* Entry */
extern "C" int user_initialize(
int argc,
char *argv[],
char *version,
char *build,
wchar_t errbuf[80])
{
pfcUICommand_ptr command;
logFile.open("log.txt", ios:ut);
logFile << "- LOGS " << endl;
logFile << "=============" << endl;
try
{
pfcSession_ptr Session = pfcGetProESession();
wfcWSession_ptr wSession = wfcWSession::cast(Session);
try {
wSession->RibbonDefinitionfileLoad("otk_install_test.rbn");
}
xcatchbegin
xcatch(pfcXToolkitError, xtoole) {
xint err = xtoole->GetErrorCode();
xstring method = xtoole->GetMethodName();
logFile << "pfcXToolkitError in method " << method << " with error " << err << "\n" << endl;
logFile << "continuing..\n";
} xcatchend
pfcUICommand_ptr InputCommand1 = wSession->UICreateCommand("OTKInstallTest", new OTKTestCallBack());
InputCommand1->Designate("msg_user.txt", "OTK Install Test", "OTK Install Test", "OTK Install Test");
return (wfcTK_NO_ERROR);
}
xcatchbegin
xcatchcip(Ex)
logFile << "Exception:\n" << Ex << endl;
return (wfcTK_NO_ERROR);
xcatchend
}
/* Exit*/
extern "C" void user_terminate()
{
logFile << endl;
logFile << "================================================" << endl;
logFile << "OTK application terminated successfully." << endl;
logFile << "================================================" << endl;
logFile.close();
}
void OTKTestCallBack::OnCommand()
{
try
{
pfcSession_ptr Session = pfcGetProESession();
Session->UIShowMessageDialog("OTK Install Test succeeded!!", NULL);
}
xcatchbegin
xcatchcip(Ex)
logFile << "Exception:\n" << Ex << endl;
xcatchend
}
|
|