I tried doing it the DL route but apparently there is some problem with Ruby properly creating the struct to be passed to the 'GetOpenFileNameA' function (at least, that's what I've encountered). But I have found a different way...
Fortunately for me, I have delved into AutoIT scripting which allows me to create an Open Dialog Box. So I then decided to write a simple script to pass all the necessary params to this application from Ruby (i.e. Dialog message and filter) and the AutoIT application returns the filename that is selected or nil if canceled.
If $CmdLine < 1 Then
ConsoleWriteError("No arguments given")
$op = $CmdLine
If $CmdLine < 3 Then
ConsoleWriteError("open command requires message and filter arguments.")
$msg = $CmdLine
$filter = $CmdLine
$selected = FileOpenDialog($msg, "", $filter, 1)
If @error Then
ConsoleWriteError("Open Dialog problem")
f = IO.popen("controls.exe open \"Select a file\" \"Text File(*.txt)\"")
This seems to work nicely. A bit of a round-trip but allows you to get what you need.
For those who don't know, AutoIT is a Windows-based automation scripting system (console and GUI wise, see some of my AutoIT posts).