Forum: Ruby Win32API GetOpenFileName called successful, but no dialog ap

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
E595569e0f14843c2ab6feeaa1dae663?d=identicon&s=25 yang cao (Guest)
on 2007-04-09 18:22
(Received via mailing list)
I want to write a module,wrapper comdlg32.dll 's Functions, but when i
the method, it has no error, but no dialog appears. my code is here:

require 'Win32API'
get_file_name ='comdlg32', 'GetOpenFileName', ['P'], 'i')
get_active_window ="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
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?

This topic is locked and can not be replied to.