Win32gui... file dialogs?

Alex Martelli alex at magenta.com
Fri Aug 25 03:55:34 EDT 2000


"Kevin Cazabon" <kcazabon at home.com> wrote in message
news:I_kp5.201386$8u4.2042579 at news1.rdc1.bc.home.com...
> I was wondering if there's any way to use Mark Hammond's Win32 extensions
to
> access the Windows file dialogs (Load/Save) to get a list of filenames
back.
    [snip]
> Any suggestions?
>
> Mark?  (any advice from the Guru?)  q:]

There's a win32gui.GetOpenFileName function, but I can't find
usable docs on it; trying to call it elicits the info that it
requires a 76-byte string, but it's hard to fathom what is to
go into that string.  The win32all stuff is truly rich, but
the scarcity/imprecision of information is a critical issue;
it helps to be a Win32-API-guru, but it's not quite enough...
here, the argument is no doubt meant to represent the
OPENFILENAME structure that's passed to the GetOpenFileName
underlying API call, perhaps through standard module struct,
but it's hard to be more definite than that, and lots of
experimentation would be needed (and/or sources study:-).

One alternative is to operate through COM components; there
are enough of those to let you do basically anything:-).

For common-dialogs, for example, you can use comdlg32.ocx
(if you don't have it on your system, it can be obtained
from various places); it's an ActiveX control, and needs
to be instantiated in a suitable ActiveX container, e.g.,
an Internet Explorer instance using the OBJECT tag
<OBJECT
   CLASSID="clsid:F9043C85-F6F2-101A-A3C9-08002B2F49FB"
   ID='DialObj'>
</OBJECT>
or you could use a PythonWin window, etc.  A similar
alternative that would just let you instantiate the
common-dialogs COM server with win32com.client.Dispatch,
without having to host it as a control in a container,
might be handier sometimes, and I bet there are such
controls/servers on the net, but have no URL to offer...


Alex






More information about the Python-list mailing list