[python-win32] Specifying an initial directory name for win32ui.CreateFileDialog()

Tim Roberts timr at probo.com
Mon Mar 30 22:29:20 CEST 2009


Tony Cappellini wrote:
>
> I want to specify the directory in which win32ui
> <win32ui.html>.CreateFileDialog() should be displayed.
> The arguments in the help PyCFileDialog <PyCFileDialog.html> =
> *CreateFileDialog(/bFileOpen//, defExt/ /, fileName/ /, flags/ /,
> filter/ /, parent/ *)
> don't seem to allow this.
>
> I know I can specify the initial  director (among other things) when I
> invoke the File Open browser from wxPython and other gui frameworks.
>
> How do I do this with the bare bones Win32 api?

That function returns an object to you, which wraps the OPENFILENAME
structure from the common dialog.  You can call
    dlg.SetOFNInitialDir( 'xxx' )
to set the initial directory before you call
    dlg.DoModal()
to display the dialog.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the python-win32 mailing list