win32gui.FindWindow problems

Tim Roberts timr at
Mon Nov 13 05:37:21 CET 2000

"Alex Martelli" <aleaxit at> wrote:

>"Dale Strickland-Clark" <dale at> wrote in message
>news:q05p0told569nfa8m1j0gougvau06a5h0u at
>    [snip]
>> I can't make it work either. It's not clear from the docs how to specify a
>NULL for the first arg -
>> which is what I think you need. I tried 0 and None but both crash Python.
>FindWindow is not documented in the Win32 API's to support NULL as
>a first parameter.

I was going to give you a big "HUH?" in response to this, but I see that
the MSDN web page on FindWindow does not explicitly state that NULL is
allowed for the class name.  This is a documentation failure, not an API
restriction: the MSDN web page is incomplete.  NULL is a valid option for
either parameter to FindWindow, and specifies that the option is not to be
used as a criteria in the search.  It has always worked, and it will
continue to work.

The page on CWnd::FindWindow says this explicitly:

and CWnd::FindWindow is implemented as an inline call to FindWindow.
Microsoft uses the NULL first parameter in their examples; see knowledge
base article Q124103.

Dale correctly pointed out the problem; he needs to pass a NULL, not a
zero-length string.  I don't know how to do this, either.
- Tim Roberts, timr at
  Providenza & Boekelheide, Inc.

More information about the Python-list mailing list