Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python and ShutdownBlockReasonCreate, ShutdownBlockReasonDestroy, and ShutdownBlockReasonQuery

Tags:

python

winapi

Is it possible to call the ShutdownBlockReasonCreate, ShutdownBlockReasonDestroy, and ShutdownBlockReasonQuery win32 APIs from within Python? I can't find them anywhere in the pywin32 library.

Thanks!

like image 492
Dave Avatar asked Oct 20 '25 09:10

Dave


1 Answers

Use ctypes

from ctypes import *
retval = windll.user32.ShutdownBlockReasonCreate(
    handle,
    c_wchar_p("the reason")
)
if retval != 0:
    ... Error checking

And similarly with ShutdownBlockReasonDestroy.

like image 108
David Heffernan Avatar answered Oct 22 '25 23:10

David Heffernan