NX二次开发-UFUN打开选择文件夹对话框UF_UI_create_filebox

 1 #include <uf.h>
 2 #include <uf_ui.h>
 3 #include <string>
 4
 5 using namespace std;
 6
 7 string OpenDirectionDialog(char* lpszDefault)
 8 {
 9     //去除字符串末尾的\;
10     int nlast = strlen(lpszDefault) - 1;
11     string strDefault = lpszDefault;
12     if (strDefault.at(nlast) == ‘\\‘)
13         strDefault.at(nlast) = ‘\0‘;
14
15     int nResponse = 0;
16     char lpszDefaultFile[256] = "";
17     char lpszFileFiter[133] = "Direction";
18     char lpszFilePath[256] = "";
19     //设置初始目录;
20     sprintf_s(lpszDefaultFile, 256, "%s\\%ss", strDefault.c_str(), lpszFileFiter);
21     UF_UI_create_filebox("选择一个目录", "目录浏览器", lpszFileFiter, lpszDefaultFile, lpszFilePath, &nResponse);
22
23     string strPath, strPathSel;
24     if (nResponse == UF_UI_OK)
25     {
26         strPath = lpszFilePath;
27         //去除Direction;
28         int nPos = strPath.rfind("\\");
29         strPathSel = strPath.substr(0, nPos);
30     }
31     else
32     {
33         strPathSel = "";
34     }
35
36     return strPathSel;//选择文件夹返回值为路径,没选择文件夹返回值为空
37 }

原文地址:https://www.cnblogs.com/nxopen2018/p/11829577.html

时间: 2024-07-31 14:35:24

NX二次开发-UFUN打开选择文件夹对话框UF_UI_create_filebox的相关文章

NX二次开发-UFUN参数选择对话框UF_UI_select_parameters

1 #include <uf.h> 2 #include <uf_ui.h> 3 #include <uf_modl.h> 4 5 6 UF_initialize(); 7 8 //参数选择对话框 9 UF_FEATURE_SIGN sign = UF_NULLSIGN; 10 double dBlockOrig[3] = { 0.0, 0.0, 0.0 }; 11 char* sBlockLengh[3] = { "1", "2"

NX二次开发-UFUN打开part UF_PART_open

1 NX11+VS2013 2 3 #include <uf.h> 4 #include <uf_part.h> 5 6 7 UF_initialize(); 8 9 //打开part 10 tag_t partTag = NULL_TAG; 11 UF_PART_load_status_t error_status; 12 UF_PART_open("D:\\123.prt", &partTag, &error_status); 13 //释放

弹出打开/保存文件对话框 选择文件夹对话框

打开/保存文件对话框: CFileDialog::CFileDialog( BOOL bOpenFileDialog, //为TRUE则显示打开对话框,为FALSE则显示保存对话文件对话框 LPCTSTR lpszDefExt = NULL, //默认的文件扩展名 LPCTSTR lpszFileName = NULL, //默认的文件名 DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, //设定风格 LPCTSTR lpszFilt

java 选择文件夹对话框

java swing 选择文件夹对话框 import java.io.File; import javax.swing.JFileChooser; public class Test2 { public static void main(String[] args) { JFileChooser jf = new JFileChooser(); jf.setSelectedFile(new File("c:\\我的报表.xls")); int value = jf.showSaveDi

Windows--MFC选择文件对话框和选择文件夹对话框

选择单个文件对话框: 1 CString strFile = _T(""); 2 3 CFileDialog dlgFile(TRUE, NULL, NULL, OFN_HIDEREADONLY, _T("Describe Files (*.jpg)|*.jpg|All Files (*.*)|*.*||"), NULL); 4 5 if (dlgFile.DoModal()) 6 { 7 strFile = dlgFile.GetPathName(); 8 } 选

NX二次开发-UFUN和NXOpen结合开发中Tag_t对象与TaggedObject对象转换方法

1 本文通过举四个例子来告诉大家在NX二次开发过程中会经常用到UFUN和NXOpen结合去开发,在UFUN中我们得到的是Tag_t对象,在NXOpen中得到的是TaggedObject对象,这两个是需要进行转换的.本文主要知识点为:TaggedObject->tag_t() , NXOpen::NXObjectManager::Get(BodyTag1) , feature1->JournalIdentifier()的用法. 2 3 NX11+VS2013 4 5 #include <u

NX二次开发-UFUN选择草图对话框UF_UI_select_sketch

1 #include <uf.h> 2 #include <uf_ui.h> 3 4 5 UF_initialize(); 6 7 //选择草图对话框 8 char sMessage[] = "选择草图对话框"; 9 tag_t tSketch; 10 int iResponse; 11 UF_UI_select_sketch(sMessage, NULL, &tSketch, &iResponse); 12 13 14 UF_terminate

NX二次开发-UFUN写入本地文本文档uc4524

1 NX9+VS2012 2 3 #include <uf.h> 4 #include <uf_cfi.h> 5 #include <uf_ui.h> 6 7 using std::string; 8 9 10 11 UF_initialize(); 12 13 //内容1 14 //读取文本全部内容 15 //打开本地文本文档 16 int Chan = uc4504("D:\\123.txt", 1, 79);//类型为只读,后缀类型txt为79

NX二次开发-UFUN关闭本地文本文档uc4540

1 NX9+VS2012 2 3 #include <uf.h> 4 #include <uf_cfi.h> 5 #include <uf_ui.h> 6 7 using std::string; 8 9 10 11 UF_initialize(); 12 13 //内容1 14 //读取文本全部内容 15 //打开本地文本文档 16 int Chan = uc4504("D:\\123.txt", 1, 79);//类型为只读,后缀类型txt为79