zoukankan      html  css  js  c++  java
  • 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) = '';
    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 }
  • 相关阅读:
    Tomcat部署方式
    JAVA顺序队列
    JAVA稀疏数组
    JAVA数组
    JAVA运算符
    JAVA数据类型
    《IBM —PC 汇编语言程序设计》 第三章习题
    《IBM —PC 汇编语言程序设计》 第二章习题
    W3school导航条 CSS
    网易新闻CSS
  • 原文地址:https://www.cnblogs.com/nxopen2018/p/11829577.html
Copyright © 2011-2022 走看看