Send {LWin}
sleep 500
hwnd := DllCall("FindWindowEx", "ptr", 0, "ptr", 0, "str", "Windows.UI.Core.CoreWindow", "str", "Start", "ptr")
DllCall("LoadLibrary","str","oleacc","ptr")
VarSetCapacity(IID_IAccessible, 16)
DllCall("ole32\CLSIDFromString", "wstr", "{618736e0-3c3d-11cf-810c-00aa00389b71}", "ptr", &IID_IAccessible)
DllCall("oleacc\AccessibleObjectFromWindow", "ptr", hwnd, "uint", OBJID_CLIENT := 0xFFFFFFFC, "ptr", &IID_IAccessible, "ptr*", pacc)
Send {LWin}
Sleep 500
UnFreeze(200, Func("MyFunc"))
VarSetCapacity(variant, 8+A_PtrSize*2, 0)
NumPut(VT_I4 := 3, variant, 0, "ushort")
if (A_PtrSize = 4)
DllCall(NumGet(NumGet(pacc+0)+10*A_PtrSize), "ptr", pacc, "int64", NumGet(variant, 0, "int64"), "int64", NumGet(variant, 8, "int64"), "ptr*", name) ; get_accName
else
DllCall(NumGet(NumGet(pacc+0)+10*A_PtrSize), "ptr", pacc, "ptr", &variant, "ptr*", name) ; get_accName
msgbox ok
MyFunc()
{
Send {LWin}
}
UnFreeze(timeOut, userFunc) {
static SYNCHRONIZE := 0x100000, hGui, oInfo := {}
, _ := OnMessage( msg := DllCall("RegisterWindowMessage", Str, "WM_INFO"), Func("WM_INFO").Bind(oInfo) )
if !hGui
Gui, New, +hwndhGui
hProc := DllCall("OpenProcess", UInt, SYNCHRONIZE, UInt, 0, UInt, DllCall("GetCurrentProcessId"), Ptr)
pPtr := GetProcAddr(hProc, hGui, msg, timeOut)
oInfo.func := userFunc, oInfo.hProc := hProc
DllCall("CreateThread", Ptr, 0, Ptr, 0, Ptr, pPtr, Ptr, 0, UInt, 0, Ptr, 0)
}
WM_INFO(oInfo)
{
DllCall("CloseHandle", Ptr, oInfo.hProc)
oInfo.func.Call()
}
GetProcAddr(Handle, hWnd, Msg, Timeout=-1)
{ ; на основе http://forum.script-coding.com/viewtopic.php?pid=56073#p56073
static MEM_COMMIT := 0x1000, PAGE_EXECUTE_READWRITE := 0x40
ptr := DllCall("VirtualAlloc", Ptr, 0, Ptr, A_PtrSize = 4 ? 49 : 85, UInt, MEM_COMMIT, UInt, PAGE_EXECUTE_READWRITE, Ptr)
, hModule := DllCall("GetModuleHandle", Str, "kernel32.dll", Ptr)
, pWaitForSingleObject := DllCall("GetProcAddress", Ptr, hModule, AStr, "WaitForSingleObject", Ptr)
, hModule := DllCall("GetModuleHandle", Str, "user32.dll", Ptr)
, pSendMessageW := DllCall("GetProcAddress", Ptr, hModule, AStr, "SendMessageW", Ptr)
, NumPut(pWaitForSingleObject, ptr*1)
, NumPut(pSendMessageW, ptr + A_PtrSize)
if (A_PtrSize = 4) {
NumPut(0x68, ptr + 8, "UChar")
, NumPut(Timeout, ptr + 9, "UInt"), NumPut(0x68, ptr + 13, "UChar")
, NumPut(Handle, ptr + 14), NumPut(0x15FF, ptr + 18, "UShort")
, NumPut(ptr, ptr + 20), NumPut(0x6850, ptr + 24, "UShort")
, NumPut(Handle, ptr + 26), NumPut(0x68, ptr + 30, "UChar")
, NumPut(Msg, ptr + 31, "UInt"), NumPut(0x68, ptr + 35, "UChar")
, NumPut(hWnd, ptr + 36), NumPut(0x15FF, ptr + 40, "UShort")
, NumPut(ptr+4, ptr + 42), NumPut(0xC2, ptr + 46, "UChar"), NumPut(4, ptr + 47, "UShort")
}
else {
NumPut(0x53, ptr + 16, "UChar")
, NumPut(0x20EC8348, ptr + 17, "UInt"), NumPut(0xBACB8948, ptr + 21, "UInt")
, NumPut(Timeout, ptr + 25, "UInt"), NumPut(0xB948, ptr + 29, "UShort")
, NumPut(Handle, ptr + 31), NumPut(0x15FF, ptr + 39, "UShort")
, NumPut(-45, ptr + 41, "UInt"), NumPut(0xB849, ptr + 45, "UShort")
, NumPut(Handle, ptr + 47), NumPut(0xBA, ptr + 55, "UChar")
, NumPut(Msg, ptr + 56, "UInt"), NumPut(0xB948, ptr + 60, "UShort")
, NumPut(hWnd, ptr + 62), NumPut(0xC18941, ptr + 70, "UInt")
, NumPut(0x15FF, ptr + 73, "UShort"), NumPut(-71, ptr + 75, "UInt")
, NumPut(0x20C48348, ptr + 79, "UInt"), NumPut(0xC35B, ptr + 83, "UShort")
}
return ptr + A_PtrSize*2
}