我是菜鸟哈,请教大家一下~
点击button,出现一个浏览文件夹来选择路径,是怎么做的呢
------解决方案--------------------
使用GetFileOpenName
li_rtn = GetFileOpenName("Select File", &
docpath, docname, "PDF", &
+ "PDF Files (*.PDF),*.PDF," &
+ "Doc Files (*.DOC),*.DOC," &
+ "All Files (*.*), *.*", &
"d:\", 18)
IF li_rtn < 1 THEN return
ls_filename = string(docpath)
------解决方案--------------------
The following example displays a Select File dialog box that allows multiple selection. The file types are TXT, DOC, and all files, and the initial directory is C:\Program Files\Sybase. The option flag 18 specifies that the Explorer-style dialog box is used (2^1 = 2), and the Read Only check box is hidden (2^4 = 16). The selected filenames are displayed in a MultiLineEdit control.
string docpath, docname[]
integer i, li_cnt, li_rtn, li_filenum
li_rtn = GetFileOpenName("Select File", &
docpath, docname[], "DOC", &
+ "Text Files (*.TXT),*.TXT," &
+ "Doc Files (*.DOC),*.DOC," &
+ "All Files (*.*), *.*", &
"C:\Program Files\Sybase", 18)
IF li_rtn < 1 THEN return
li_cnt = Upperbound(docname)
for i=1 to li_cnt
mle_selected.text +=
string(docpath)+"\"+(string(docname[i]))+"~r~n"
next
In the following example, the dialog box has the title Open and displays text files, batch files, and INI files in the Files of Type drop-down list. The initial directory is d:\temp. The option flag 512 specifies that the old-style dialog box is used and the Network button is hidden (2^9 = 512).
// instance variables
// string is_filename, is_fullname
int li_fileid
if GetFileOpenName ("Open", is_fullname, is_filename, &
"txt", "Text Files (*.txt),*.txt,INI Files " &
+ "(*.ini), *.ini,Batch Files (*.bat),*.bat", &
"d:\temp", 512) < 1 then return
li_fileid = FileOpen (is_fullname, StreamMode!)
FileRead (li_fileid, mle_notepad.text)
FileClose (li_fileid)