Proe5.0导出PDF至配置文件的相关方法,VC++
定义文件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 // CbcsproeApp BEGIN_MESSAGE_MAP(CbcsproeApp, CWinApp)
END_MESSAGE_MAP() // CbcsproeApp 构造 CbcsproeApp::CbcsproeApp()
{
// TODO: 在此处添加构造代码,
// 将所有重要的初始化放置在 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); //login
status = 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文件导出pdf"));
return;
} ProName name;
err = ProMdlNameGet(mdl, name);
CString cstrName = name;
CString outfilepathname = Path;
outfilepathname = outfilepathname +L"\\" + cstrName + L".pdf";
//AfxMessageBox(outfilepathname.GetBuffer(0)); //导出pdf
ProPDFExport(mdl,outfilepathname.GetBuffer(0),ops);
ProPDFoptionsFree(ops);
AfxMessageBox(_T("导出完成!"));////弹出一个消息框
}
下面是关于在Proe客户端的配置
定义注册文件
Protk.dat
内容如下:
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
若想实现Proe自动注册,则将此文件放置Proe的安装目录的text文件下,例如:C:\Program Files\proeWildfire 5.0\text,具体路径根据自己安装目录指定
注:文件名必须为Protk不能更换
Proe5.0导出PDF至配置文件的相关方法,VC++的更多相关文章
- asp.net2.0导出pdf文件完美解决方案【转载】
asp.net2.0导出pdf文件完美解决方案 作者:清清月儿 PDF简介:PDF(Portable Document Format)文件格式是Adobe公司开发的电子文件格式.这种文件格式与操作系统 ...
- Itext2.0.8 和freemarker导出pdf
这个是跟上一篇写的freemarker导出word是一块的.但是关联性不是很大.由于本人技术有限本篇导出也是根据网上大家的做出的demo混合而成.有不足的地方请大家指出.好改正,使以后看到的freem ...
- .Net导出pdf文件,C#实现pdf导出
最近碰见个需求需要实现导出pdf文件,上网查了下代码资料总结了以下代码.可以成功的实现导出pdf文件. 在编码前需要在网上下载个itextsharp.dll,此程序集是必备的.楼主下载的是5.0版本, ...
- JS导出PDF插件(支持中文、图片使用路径)
在WEB上想做一个导出PDF的功能,发现jsPDF比较多人推荐,遗憾的是不支持中文,最后找到pdfmake,很好地解决了此问题.它的效果可以先到http://pdfmake.org/playgroun ...
- ITextSharp导出PDF表格和图片(C#)
文章主要介绍使用ITextSharp导出PDF表格和图片的简单操作说明,以下为ITextSharp.dll下载链接 分享链接:http://pan.baidu.com/s/1nuc6glj 密码:3g ...
- JAVA导出pdf实例
一.直接导出成PDF Java代码 1. import java.io.FileNotFoundException; 2. import java.io.FileOutputStream; 3. ...
- 利用ITextSharp导出PDF文件
最近项目中需要到处PDF文件,最后上网搜索了一下,发现ITextSharp比较好用,所以做了一个例子: public string ExportPDF() { //ITextSharp Usage / ...
- iText导出pdf、word、图片
一.前言 在企业的信息系统中,报表处理一直占比较重要的作用,本文将介绍一种生成PDF报表的Java组件--iText.通过在服务器端使用Jsp或JavaBean生成PDF报表,客户端采用超级连接显示或 ...
- Itext导出PDF,word,图片案例
iText导出pdf.word.图片 一.前言 在企业的信息系统中,报表处理一直占比较重要的作用,本文将介绍一种生成PDF报表的Java组件--iText.通过在服务器端使用Jsp或JavaBean生 ...
随机推荐
- oracle11g数据库的安装
先在 Oracle官网上下载11g oracle Database 11g 第 2 版 (11.2.0.1.0) 标准版.标准版 1 以及企业版,适用于 Microsoft Windows (x6 ...
- openstack trove实例状态转换条件--Mitaka版本
今天研究了一下trove的instance状态转换条件.发现其实设计的挺复杂的.后来思考了一下这样设计的原因.我觉得大致是因为,如果instance的状态全部来自于instance上跑的数据库服务本身 ...
- Egret Engine 2D - 缩放模式和旋转模式说明
缩放模式和旋转模式说明 缩放模式showAll 常用 noScale noBorder exactFit 次常用 fixedWidth fixedHeight fixedNarrow fixedWid ...
- .NET CORE AutoMapper使用
1.通过nuget安装AutoMapper,版本是7.0.1, 安装AutoMapper.Extensions.Microsoft.DependencyInjection 版本是4.0.1 不是以上 ...
- JS常用的正则表达式包
结构: Code: /* 用途:检查输入的Email信箱格式是否正确 输入:strEmail:字符串 返回:如果通过验证返回true,否则返回false */ function checkEmail( ...
- ImportError: dynamic module does not define init function (initcaffe)
https://github.com/BVLC/caffe/issues/2770 $ python2 -c "import caffe" Traceback (most rece ...
- swift 录音 AVAudioRecorder
2018年05月16日 15:22:44 msmwncx阅读数:548 https://blog.csdn.net/msmwncx/article/details/80336973 版权声明:本文为博 ...
- Jenkins-在Centos上配置自动化部署(Jenkins+Gitlab+Rancher)
Jenkins-在Centos上配置自动化部署(Jenkins+Gitlab+Rancher) 环境:centos7 首先在服务器上安装好Jenkins和Gitlab和Rancher Gitlab安装 ...
- PAT Advanced 1030 Travel Plan (30) [Dijkstra算法 + DFS,最短路径,边权]
题目 A traveler's map gives the distances between cities along the highways, together with the cost of ...
- trove module使用说明
原文来自:https://github.com/openstack/openstack-manuals/blob/master/doc/user-guide/source/database-modul ...