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

Y

yang cao

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top