mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-06-06 10:23:06 +03:00
Split enumwindowsproc() conditional into multiple lines
This commit is contained in:
parent
bf7e21a94f
commit
1714219c17
@ -120,16 +120,16 @@ if __name__ == '__main__':
|
|||||||
def enumwindowsproc(window_handle, l_param):
|
def enumwindowsproc(window_handle, l_param):
|
||||||
# class name limited to 256 - https://msdn.microsoft.com/en-us/library/windows/desktop/ms633576
|
# class name limited to 256 - https://msdn.microsoft.com/en-us/library/windows/desktop/ms633576
|
||||||
cls = ctypes.create_unicode_buffer(257)
|
cls = ctypes.create_unicode_buffer(257)
|
||||||
if GetClassName(window_handle, cls, 257) \
|
if GetClassName(window_handle, cls, 257):
|
||||||
and cls.value == 'TkTopLevel' \
|
if cls.value == 'TkTopLevel':
|
||||||
and window_title(window_handle) == applongname \
|
if window_title(window_handle) == applongname:
|
||||||
and GetProcessHandleFromHwnd(window_handle):
|
if GetProcessHandleFromHwnd(window_handle):
|
||||||
# If GetProcessHandleFromHwnd succeeds then the app is already running as this user
|
# If GetProcessHandleFromHwnd succeeds then the app is already running as this user
|
||||||
if len(sys.argv) > 1 and sys.argv[1].startswith(protocolhandler_redirect):
|
if len(sys.argv) > 1 and sys.argv[1].startswith(protocolhandler_redirect):
|
||||||
CoInitializeEx(0, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE)
|
CoInitializeEx(0, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE)
|
||||||
# Wait for it to be responsive to avoid ShellExecute recursing
|
# Wait for it to be responsive to avoid ShellExecute recursing
|
||||||
ShowWindow(window_handle, SW_RESTORE)
|
ShowWindow(window_handle, SW_RESTORE)
|
||||||
ShellExecute(0, None, sys.argv[1], None, None, SW_RESTORE)
|
ShellExecute(0, None, sys.argv[1], None, None, SW_RESTORE)
|
||||||
|
|
||||||
# This performs the edmc://auth check and forward
|
# This performs the edmc://auth check and forward
|
||||||
EnumWindows(enumwindowsproc, 0)
|
EnumWindows(enumwindowsproc, 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user