日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > c/c++ >内容正文

c/c++

Proe5.0导出PDF至配置文件的相关方法,VC++

發(fā)布時間:2024/10/12 c/c++ 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Proe5.0导出PDF至配置文件的相关方法,VC++ 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

定義文件bcsMessage.txt

PLM
PLM
PLM
#

login
login
測試
#

Active messagebox menu
Active messagebox menu
激活菜單
#

將Menu文件放置與程序同級的text文件夾下

配置ini文件

[BCS]
Path=C:\3

將配置文件放置Proe的工作目錄下

?

代碼如下:

C++

// bcsproe.cpp : 定義 DLL 的初始化例程。 //#include "stdafx.h" #include "bcsproe.h" #include "afx.h"#include "ProMenu.h" #include "ProUtil.h" #include "ProMenubar.h" #include "ProPDF.h"static uiCmdAccessState AccessDefault (uiCmdAccessMode); void login(); void exportpdf();#ifdef _DEBUG #define new DEBUG_NEW #endif// CbcsproeAppBEGIN_MESSAGE_MAP(CbcsproeApp, CWinApp) END_MESSAGE_MAP()// CbcsproeApp 構(gòu)造CbcsproeApp::CbcsproeApp() {// TODO: 在此處添加構(gòu)造代碼,// 將所有重要的初始化放置在 InitInstance 中 }// 唯一的一個 CbcsproeApp 對象CbcsproeApp theApp;// CbcsproeApp 初始化BOOL CbcsproeApp::InitInstance() {CWinApp::InitInstance();return TRUE; } extern "C" int user_initialize() {ProError status;ProFileName message_file;uiCmdCmdId cmd_id1;ProFileName MsgFile;ProStringToWstring(MsgFile, "bcsMessage.txt");status=ProMenubarMenuAdd ("PLM", "PLM","Utilities", PRO_B_TRUE, MsgFile);//loginstatus = ProCmdActionAdd("ShowTest1",(uiCmdCmdActFn)login,uiCmdPrioDefault,AccessDefault,PRO_B_TRUE,PRO_B_TRUE,&cmd_id1);status = ProMenubarmenuPushbuttonAdd("PLM", "login", "login","Active messagebox menu", NULL,PRO_B_TRUE, cmd_id1, ProStringToWstring(message_file, "bcsMessage.txt"));return status; }extern "C" void user_terminate() {AFX_MANAGE_STATE(AfxGetStaticModuleState()); }/*================================================================*\ FUNCTION: AccessDefault() \*================================================================*/ static uiCmdAccessState AccessDefault (uiCmdAccessMode access_mode) {return (ACCESS_AVAILABLE); }void login()/消息框 {exportpdf();return; }void exportpdf() {ProError err;ProPath current_path;char c_p[200];err=ProDirectoryCurrentGet(current_path);if (err!=PRO_TK_NO_ERROR){AfxMessageBox(_T("未獲取到Proe起始目錄"));return;}ProWstringToString(c_p,current_path);CString strcurrent_path = current_path;獲取配置文件路徑CString FileName =L"\\bcsConfiguration.ini"; LPTSTR lpPath = new TCHAR[MAX_PATH];LPWSTR Path = new TCHAR[MAX_PATH];strcurrent_path = strcurrent_path + FileName;//AfxMessageBox(strcurrent_path);GetPrivateProfileString(L"BCS",L"Path",L"",Path,MAX_PATH,strcurrent_path);//AfxMessageBox(Path);if (_tcslen(Path) < 1){AfxMessageBox(L"未找到配置信息!");return;}delete [] lpPath;ProPDFOptions ops;ProPDFoptionsAlloc(&ops);ProMdl mdl;//獲取文件名err = ProMdlCurrentGet(&mdl);if (PRO_TK_NO_ERROR != err){AfxMessageBox(_T("當前沒有文件打開"));return;}ProMode mode;err = ProModeCurrentGet(&mode);if (err != PRO_TK_NO_ERROR){AfxMessageBox(_T("未獲取到當前打開文件"));return;}if (mode != PRO_MODE_DRAWING){AfxMessageBox(_T("當前只支持DRW文件導(dǎo)出pdf"));return;}ProName name;err = ProMdlNameGet(mdl, name);CString cstrName = name;CString outfilepathname = Path;outfilepathname = outfilepathname +L"\\" + cstrName + L".pdf";//AfxMessageBox(outfilepathname.GetBuffer(0));//導(dǎo)出pdfProPDFExport(mdl,outfilepathname.GetBuffer(0),ops);ProPDFoptionsFree(ops);AfxMessageBox(_T("導(dǎo)出完成!"));彈出一個消息框 }

?

下面是關(guān)于在Proe客戶端的配置

定義注冊文件

?Protk.dat

內(nèi)容如下:

NAME pt_inst_test STARTUP DLL ALLOW_STOP TRUE DELAY_START FALSE EXEC_FILE C:/Documents and Settings/Administrator/My Documents/bcsproe.dll TEXT_DIR C:/Documents and Settings/Administrator/My Documents/text REVISION 1000 END


若想實現(xiàn)Proe自動注冊,則將此文件放置Proe的安裝目錄的text文件下,例如:C:\Program Files\proeWildfire 5.0\text,具體路徑根據(jù)自己安裝目錄指定

注:文件名必須為Protk不能更換

?

轉(zhuǎn)載于:https://www.cnblogs.com/fanxingthink/p/4176152.html

總結(jié)

以上是生活随笔為你收集整理的Proe5.0导出PDF至配置文件的相关方法,VC++的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。