File Picker

Malkierian rhydonj at gmail.com
Sat Dec 7 20:49:34 PST 2013


On Saturday, 7 December 2013 at 23:18:18 UTC, Adam D. Ruppe wrote:
> On Saturday, 7 December 2013 at 23:00:00 UTC, Malkierian wrote:
>> Is there anything in D that currently brings up a window to 
>> find and choose a file, or am I going to have to make it 
>> myself?  Isn't there a built-in something or other I can hook 
>> into in Windows?
>
> Yeah, on Windows, you can just call the GetOpenFileName 
> function (or GetSaveFileName if saving) and use the common 
> dialog.
> http://msdn.microsoft.com/en-us/library/windows/desktop/ms646927(v=vs.85).aspx
>
>
> I wrote this quick example to show how you can use it in D:
>
> http://arsdnet.net/dcode/open.d
>
>
> Since the windows headers distributed with dmd are woefully 
> incomplete, the first thing I did was copy/paste the struct and 
> file definition from MSDN.
>
> Then, below that, is the main() function which shows how to 
> call it. There's a lot of customization you can do there, see 
> the Microsoft docs for more info (or search the web for any C 
> examples, the function works the same way in D.)

Man, that's great, thanks.  However, I have it set up in my 
application, and when I first call it, I get this window:

http://gyazo.com/02bc18bdc23fdf3c24aa4ff70b46be1f

Then, if I cancel and open it again, I get the actual browser, 
but then my program freezes up:

http://gyazo.com/4e5e873e57cd7a234d56c7a42198ab89

Any idea why it doesn't work the first time, but then does the 
second and freezes?


More information about the Digitalmars-d-learn mailing list