File Picker

Adam D. Ruppe destructionator at gmail.com
Sat Dec 7 15:18:17 PST 2013


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.)


More information about the Digitalmars-d-learn mailing list