# Win32API GetOpenFileName called successful, but no dialog ap

**URL:** <https://www.ruby-forum.com/t/win32api-getopenfilename-called-successful-but-no-dialog-ap/91486>\
**Category:** Ruby\
**Created:** [April 9, 2007, 6:22pm UTC](https://www.ruby-forum.com/t/win32api-getopenfilename-called-successful-but-no-dialog-ap/91486 "2007-04-09T18:22:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![yang\_cao](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/f6c823/32.png) [@yang\_cao](https://www.ruby-forum.com/u/yang_cao)\
**Post date:** [April 9, 2007, 6:22pm UTC](https://www.ruby-forum.com/t/win32api-getopenfilename-called-successful-but-no-dialog-ap/91486/1 "2007-04-09T18:22:13Z")

</div>

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!
