[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Win32API GetOpenFileName called successful, but no dialog appear,why?

yang cao

4/9/2007 4:21:00 PM

I want to write a module,wrapper comdlg32.dll 's Functions, but when i called
the method, it has no error, but no dialog appears. my code is here:

require 'Win32API'
get_file_name = Win32API.new('comdlg32', 'GetOpenFileName', ['P'], 'i')
get_active_window = Win32API.new("user32", "GetActiveWindow", [], 'L')
files=' ' * 20000
parameters_array = [ 0 ] * 20
parameters_array[0] = 76 # size of struct
parameters_array[1]= get_active_window.Call # owner
parameters_array[3] = "*.*"
parameters_array[6]= 1 + 1 # initially selected pattern
parameters_array[7]= files # initial filename and returned filename buffer
parameters_array[8]= files.size # max size of returned filenames
parameters_array[11]= "."
parameters_array[12]= "title"
parameters_array[13] = 0x4 # flags (no read only button)
parameters = parameters_array.pack('lllPlllPlllppliillll')
puts get_file_name.Call(parameters)

Who can tell me why?

thanks!