1
2
3
4
5
6
7 from ctypes import *
8 from ctypes.wintypes import *
9
10 shell32 = windll.shell32
11
13 _fields_ = (
14 ("cbSize", DWORD),
15 ("fMask", ULONG),
16 ("hwnd", HWND),
17 ("lpVerb", LPCWSTR),
18 ("lpFile", LPCWSTR),
19 ("lpParameters", LPCWSTR),
20 ("lpDirectory", LPCWSTR),
21 ("nShow", c_int),
22 ("hInstApp", HINSTANCE),
23 ("lpIDList", LPVOID),
24 ("lpClass", LPCWSTR),
25 ("hkeyClass", HKEY),
26 ("dwHotKey", DWORD),
27 ("hIconOrMonitor", HANDLE),
28 ("hProcess", HANDLE),
29 )
32 SHELLEXECUTEINFO = SHELLEXECUTEINFOW
33
34 SEE_MASK_NOCLOSEPROCESS = 0x00000040
35
36 -def ShellExecute(hwnd, operation, file, parameters, directory, showCmd):
37 if shell32.ShellExecuteW(hwnd, operation, file, parameters, directory, showCmd) <= 32:
38 raise WinError()
39
41 if not shell32.ShellExecuteExW(byref(execInfo)):
42 raise WinError()
43