[python-win32] passing args to shell functions in shell.pyd

Mark Hammond mhammond at skippinet.com.au
Wed May 5 03:05:10 EDT 2004


> Is there any way to pass args to the functions in shell.pyd,
> from Python?

Yes - just pass them like any other function.

> For example, shell.SHBrowseForFOlder  takes 6 arguments, the first of
> which is a window handle.
>
> So what is Python passing as a window handle?

If you look at the param list:
> hwndOwner=0 : int
> pidlRoot=None : PyIDL
> title=None : Unicode /string
> flags=0 : int
> callback : object
> Not yet supported - must be None
> callbackParam=0 : int

You will not they all have "default" values specified (except 'callback',
and it should).  ie, if the function was written in Python, it would look
like:

def SHBrowseForFolder(hwndOwner=0, pidlRoot=None, title=None, flags=0,
callback=None, cbparam=0):
  ...

If you want to specify a hwnd, just pass it.  Note that 'keyword' params
aren't supported, so you can't say:

SHBrowseForFolder(title="Foo")

You must say:

SHBrowseForFolder(0, None, "Foo")

Mark




More information about the Python-win32 mailing list