cd = WIN32OLE.new("MSComDlg.CommonDialog")
cd.filter = "All Files(*.*)|*.*" +"|Ruby Files(*.rb)|*.rb"
cd.filterIndex = 2
cd.maxFileSize = 128# Set MaxFileSize
cd.showOpen()
file = cd.fileName # Retrieve file, path
if not file or file==""
puts "No filename entered."
else
puts "The user selected: #{file}\n"
end
这个: Win32API.new('comdlg32.dll','GetOpenFileName'你的采纳是我前进的动力,还有不懂的地方,请继续“追问”。
如你还有别的问题,可另外向我求助;答题不易,互相理解,互相帮助。