Calling DLLs from Python [Windows]

Georgy Pruss SEE_AT_THE_END at hotmail.com
Wed Oct 8 04:52:00 EDT 2003


Hi all,

How can I call a function which is in a Windows DLL? For example,

import win32api
lib_hnd = win32api.LoadLibrary( "user32.dll" )
if lib_hnd:
     fn_addr = win32api.GetProcAddress( lib_hnd, "MessageBeep" ) # returns int(2010532466)
     if fn_addr:
          # Here I'd like to call fn_addr. In C it would be plain fn_addr()
     win32api.FreeLibrary( lib_hnd )

Google didn't help on this.

Thank you,
Georgy Pruss
E^mail: 'ZDAwMTEyMHQwMzMwQGhvdG1haWwuY29t\n'.decode('base64')






More information about the Python-list mailing list