码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2019-11-10 13:53:09      阅读:144      评论:0      收藏:0      [点我收藏+]

标签:ace   div   style   strlen   log   fun   对话   一个   文件   

 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 }

 

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

标签:ace   div   style   strlen   log   fun   对话   一个   文件   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!