[python-win32] ctypes and DLL

Marcus.CM marcus at internetnowasp.net
Thu Jul 24 19:43:27 CEST 2008


Hi Thomas,
Thanks, will give it a shot . My main concern  is that i need to use the 
code in a service and have a display msgbox is not an ideal design.

Marcus

Thomas Heller wrote:
> Marcus.CM schrieb:
>   
>> Hi
>>
>> On Windows/Vista :-
>>
>>   vr = ctypes.CDLL(str)   
>>
>> When loading a DLL that is corrupted using cytpes,  i get a bombed out 
>> box with "python.exe - bad image" as the message box title instead of 
>> handling it at my exception handler.
>> How do i do this without the ugly messagebox from python ?
>>
>> Marcus.CM.
>>     
>
> You could try changing the process error-mode flags by calling the
> Windows SetErrorMode() function before loading the dll.
>
> Probably ctypes.windll.kernel32.SetErrorMode(0x8007) will help.
> See http://msdn.microsoft.com/en-us/library/ms680621(VS.85).aspx
>   




More information about the python-win32 mailing list