How to pass NULL to a DLL using DynWin

Syver Enstad syver-en+usenet at online.no
Mon Aug 19 09:50:04 EDT 2002


Wolfhart Bauer <nospam at wolfhart-bauer.de> writes:

> Hi,
> 
> I am using the DynWin package to access DLL methods from Python. The
> problem is, I have to call a method with NULL as argument. The keyword
> 
> None does not work. Neither does cstring(None). What is the correct
> way to pass NULL as parameter?
> 
> Thanks for any help
> Wolfhart

Can't you pass 0 (anInteger)?

Here is an example using the kernel32 module (kernel32.dll) to get the
module handle to the executable of the current process.

The documentation states that the parameter can be a handle to an
executable or NULL 

Quote from the Platform SDK: 

If this parameter is NULL, GetModuleHandle returns a handle to the
file used to create the calling process.

import dynwin

>>> kernel32 = dynwin.windll.module('kernel32')
>>> kernel32.GetModuleHandle(0)
486539264

-- 

Vennlig hilsen 

Syver Enstad



More information about the Python-list mailing list