NX secondary development -UFUN open the Select Folder dialog box 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(" Select a directory " , " directory browser " , lpszFileFiter, lpszDefaultFile, lpszFilePath, & nResponse);
 22 is  
23 is      String strPath, strPathSel;
 24      IF (nResponse == UF_UI_OK)
 25      {    
 26 is          strPath = lpszFilePath;
 27          // removing the Direction; 
28          int nPos strPath.rfind = ( " \\ " );
 29          strPathSel strPath.substr = ( 0 , nPos);
 30      }
 31 is      the else 
32      {
33 is          strPathSel = "" ;
 34 is      }
 35  
36      return strPathSel; // select the folder path of the return value, the return value is not null select the folder 
37 }

 

Guess you like

Origin www.cnblogs.com/nxopen2018/p/11829577.html