
MattyD
Active Members-
Posts
327 -
Joined
-
Last visited
-
Days Won
13
MattyD's Achievements
-
Gianni reacted to a post in a topic: WinRT - WinUI3
-
Danyfirex reacted to a post in a topic: WinRT - WinUI3
-
WildByDesign reacted to a post in a topic: WinRT - WinUI3
-
Hi guys, apologies in advance for the wall of text! Just an update as to where things are ATM - I've have gone on a tangent re: resolving IIDs for paramatised interfaces. This is more of a core WinRT thing - but I thought I'd take whoever is interested along on the ride... So I attempted to create a grid (Microsoft.UI.Xaml.Controls.Grid) which should theoretically allows us drop other controls within it. Basically its a layout thing to divide up the window. Want an "OK" button down the bottom right? Just nest the button in the cell that is down there!. Creating a grid, then extracting the row and column definitions is easy enough. #include "Include\Classes\Microsoft.UI.Xaml.Controls.Grid.au3" ;-- Setup window etc. -- Local $pGrid_Fact = _WinRT_GetActivationFactory("Microsoft.UI.Xaml.Controls.Grid", $sIID_IGridFactory) Local $pGrid = IGridFactory_CreateInstance($pGrid_Fact, 0, $pInner) Local $pColDefs = IGrid_GetColumnDefinitions($pGrid) Local $pRowDefs = IGrid_GetRowDefinitions($pGrid) Looking at $pColDefs, we can determine its a "Microsoft.UI.Xaml.Controls.ColumnDefinitionCollection". We know this by inspecting Microsoft.UI.Xaml.Controls.Grid in the class explorer. Otherwise _WinRT_DisplayInterfaces($pColDefs ) or _WinRT_DisplayClass($pColDefs ) will get you to the same place. Method : get_ColumnDefinitions Fn : value = get_ColumnDefinitions() P0 : value type: Microsoft.UI.Xaml.Controls.ColumnDefinitionCollection After digging in the metadata we can resolve some IIDs of $pColDefs, but at best _WinRT_DisplayInterfaces() only gives us: Class: Microsoft.UI.Xaml.Controls.ColumnDefinitionCollection {CDFBA81A-54FA-557D-A712-21640F16C534} {749BC47C-1743-5C21-9CED-C8A1134C7BA7} {80741C8F-A401-5C63-B6C4-15D165E541C7} {E7BEAEE7-160E-50F7-8789-D63463F979FA} - IDependencyObject {EB24C20B-9816-4AC7-8CFF-36F67A118F4E} {00000038-0000-0000-C000-000000000046} - IWeakReferenceSource {DF0B3D60-548F-101B-8E65-08002B2BD119} - ISupportErrorInfo {00000000-0000-0000-C000-000000000046} - IUnknown {AF86E2E0-B12D-4C6A-9C5A-D7AA65101E90} - IInspectable But what we're looking for is these collection interfaces. TypeDef : Microsoft.UI.Xaml.Controls.ColumnDefinitionCollection Extends : System.Object Interface : Windows.Foundation.Collections.IVector`1<Microsoft.UI.Xaml.Controls.ColumnDefinition> Interface : Windows.Foundation.Collections.IIterable`1<Microsoft.UI.Xaml.Controls.ColumnDefinition> The class explorer tells us IVector should be there. Windows.Foundation.Collections.IVector`1 has a GUID defined as "{913337E9-11A1-4345-A3A2-4E7F956E222D}". so what gives? It does not appear in our list because the IVector`1 GUID is NOT an IID, it is something else called a PIID. It needs to be combined with the datatype in order to give us the IID for Windows.Foundation.Collections.IVector`1<Microsoft.UI.Xaml.Controls.ColumnDefinition>. We can probably just assume the top GUID maps to this... but we really need a way to resolve it properly. The IIDs for paramatiesed interfaces are calculated at runtime so we can't just dig in the metadata for them. Enter RoGetParameterizedTypeInstanceIID. This is the can of worms that I'm still trying to nail down - so stay tuned for part 2! Once all that is sorted I'll also need to fix the WinRT Library generator. At the moment methods involving arrays don't generate correctly, which is kinda important when dealing with collections!!!
-
Hey Numeric1, Take what we have here and go nuts my friend! We pretty much rounded off work here once we discovered the component is legacy - (you'll see that Cycho discovered some issues playing back some 4k videos). Microsoft's replacement for this is MediaEngine, and we've attempted to get that going here. There are some major issues with that project though with callbacks crashing scripts. To progress, I'd be looking at this thread to see if there's a solution there... Basically I stopped working on MediaEngine once I managed to get the MediaPlayerElement control going. But by all means feel free to carry the torch - you may yet re-enthuse people.
-
WildByDesign reacted to a post in a topic: WinRT - WinUI3
-
MattyD reacted to a post in a topic: WinRT - WinUI3
-
my pleasure mate and thanks for the info. From some precursory reading, I think we might have to set a pallet for dark mode by setting the resources property of Microsoft.UI.Xaml.Application. But take that with a pinch of salt - I'll need to sus it out properly!
-
Hi folks, bit more progress. You can push the button using a mocked-up delegate. (same technique used for the colorPicker example in the other WinRT thread.) Its a bit of a manual process for now, but the plan is to build in a few internal funcs to streamline things... Main points of difference: We have a working button! Dumb error - there was a iWinID filter in place. So the main window messages were getting through, but button messages weren't being processed. We break out of the message loop when our winproc handles WM_DESTROY. Previously I was sending WM_QUIT when the "X" was pressed - i.e. looking for SC_CLOSE in a WM_SYSCOMMAND message. We're now properly closing the dispatch queue with a PostQuitMessage call. This means we can make use of RunEventLoop() without being stuck in an endless loop Last upload broke the class explorer, so that now should be fixed too. I've attached the two changed files to save people re-downloading the whole zip again... ClassExplorer v2.3.3.au3 WindowTest.au3
-
MattyD reacted to a post in a topic: Help File/Documentation Issues. (Discussion Only)
-
argumentum reacted to a post in a topic: Help File/Documentation Issues. (Discussion Only)
-
Help File/Documentation Issues. (Discussion Only)
MattyD replied to guinness's topic in AutoIt Technical Discussion
haha sure (bravely ran sir Robin!). But yeah, I'm happy enough to have a crack - and also to be swatted back. I just didn't want to be too presumptuous by putting something together. If you're fixing links though... its probably worth checking out a few more on that page. I haven't been through them all, but i know the garybeene.com ones under the "Advanced COM usage" section have also died of old age! -
Help File/Documentation Issues. (Discussion Only)
MattyD replied to guinness's topic in AutoIt Technical Discussion
Hi guys, just suggestion. If we wanted to update the OLEView demo on the Obj/COM Reference page, perhaps this project could replace the old tool? Its a bit of a mission finding/getting the old one up and running. (I gave it a go, and needed to pull some stuff via waybackmachine) To roughly replicate the exercise of pulling up the typelib on the "new" viewer Registry Menu > Implemented Categories Control > Microsoft Web Browser > Right click the object > View Type Library -
Danyfirex reacted to a post in a topic: WinRT - WinUI3
-
MattyD reacted to a post in a topic: _WinAPI_SetWinEventHook() help file example - help
-
Hi all, Ive updated the example with an initial attempt at a button control. Its non-interactive, and you need to roll over the widow before it appears ATM. But I'll keep chipping away at it... I've also updated the instructions in post #1. We're now using the bootstrapper as explained above, so that'll require installing the runtime. I haven't tested this with a fresh machine, so please let me know if there's issues getting the script to run! Edit: if you comment out the while loop around line 125, then uncomment this bit below, the button then becomes "clickable". You will need to force-kill the script to exit though... Looks like more digging into the dispatcher/msg loop is on the cards... IDispatcherQueue3_RunEventLoop($pDispatchQ)
-
argumentum reacted to a post in a topic: _WinAPI_SetWinEventHook() help file example - help
-
MattyD reacted to a post in a topic: _WinAPI_SetWinEventHook() help file example - help
-
_WinAPI_SetWinEventHook() help file example - help
MattyD replied to argumentum's topic in AutoIt GUI Help and Support
yeah so I have a bunch of VMs on a 2011 iMac... but I doubt it'll handle win10. I can test on Win3.1 if you'd like It probably depends on what we want to achieve here. In honesty, I'd say the simplest fix to the "it's broken" problem is to just change what the example does. Otherwise sure, let's attempt to replicate the original behavior. It'll be a good learning exercise anyway. If a broader UDF is necessary I'm happy to contribute where I can - but this is probably jumping the gun... ATM I'm just prodding at things to see whats possible, so I'm not there yet! Anyway I've worked out the Win10 thing. You need to use a dll handle with DllCall rather than specifying a string - obvioulsy unloading "Oleacc.dll" causes issues!. I've no idea why the scite menus worked in win10, but the notepad ones cause an access violation.... Here's the update: #AutoIt3Wrapper_Au3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #AutoIt3Wrapper_UseX64=Y ;x86 is broken - future Matt's problem!. #include <GuiMenu.au3> #include <SendMessage.au3> #include <WinAPIGdi.au3> #include <WinAPIMisc.au3> #include <WinAPIProc.au3> #include <WinAPISys.au3> #include <WindowsConstants.au3> #include <APIErrorsConstants.au3> Global Const $S_OK = 0, $S_FALSE = 1 Global Enum $VT_EMPTY = 0, _ $VT_I4 = 3, _ $VT_BSTR = 8, _ $VT_DISPATCH = 9 Global $tagVt_I4 = "align 2;ushort vt;word Pad[3];int data" Global $tagVt_Dispatch = "align 2;ushort vt;word Pad[3];ptr data" Global Const $sIID_NULL = "{00000000-0000-0000-0000-000000000000}" Global Const $sIID_IDispatch = "{00020400-0000-0000-C000-000000000046}" Global Const $sIID_IUnknown = "{00000000-0000-0000-C000-000000000046}" Global Const $sIID_IAccessible = "{618736e0-3c3d-11cf-810c-00aa00389b71}" Global $tagIDispatch = "GetTypeInfoCount hresult(uint*);" & _ "GetTypeInfo hresult(uint;int;ptr*);" & _ "GetIDsOfNames hresult(struct*;wstr;uint;int;int);" & _ "Invoke hresult(int;struct*;int;word;ptr*;ptr*;ptr*;uint*);" ;Use struct* instead of variant for input. if sending 0 as variant, the value doesn't seem to be sent as VT_I4. (Probably VT_EMPTY) Global $tagIAccessible = $tagIDispatch & _ "get_accParent hresult(ptr*);" & _ "get_accChildCount hresult(long*);" & _ "get_accChild hresult(struct*;ptr*);" & _ "get_accName hresult(struct*;bstr*);" & _ "get_accValue hresult(struct*;bstr*);" & _ "get_accDescription hresult(struct*;bstr*);" & _ "get_accRole hresult(struct*;variant*);" & _ "get_accState hresult(struct*;variant*);" & _ "get_accHelp hresult(struct*;bstr*);" & _ "get_accHelpTopic hresult(bstr*;struct*;long*);" & _ "get_accKeyboardShortcut hresult(struct*;bstr*);" & _ "get_accFocus hresult(struct*);" & _ "get_accSelection hresult(variant*);" & _ "get_accDefaultAction hresult(struct*;bstr*);" & _ "accSelect hresult(long;struct*);" & _ "accLocation hresult(long*;long*;long*;long*;struct*);" & _ "accNavigate hresult(long;variant;variant*);" & _ "accHitTest hresult(long;long;variant*);" & _ "accDoDefaultAction hresult(struct*);" & _ "put_accName hresult(struct*;bstr);" & _ "put_accValue hresult(struct*;bstr);" Global $__g_hDllOleacc = DllOpen("Oleacc.dll") Global $hEventProc = DllCallbackRegister('_EventProc', 'none', 'ptr;dword;hwnd;long;long;dword;dword') OnAutoItExitRegister('OnAutoItExit') Global $hEventHook = _WinAPI_SetWinEventHook($EVENT_SYSTEM_MENUPOPUPSTART, $EVENT_SYSTEM_MENUPOPUPEND, DllCallbackGetPtr($hEventProc)) Global $iNotepad_PID = ShellExecute('notepad.exe') While ProcessExists($iNotepad_PID) Sleep(1000) WEnd Func OnAutoItExit() _WinAPI_UnhookWinEvent($hEventHook) DllCallbackFree($hEventProc) DllClose($__g_hDllOleacc) EndFunc ;==>OnAutoItExit Func _EventProc($hEventHook, $iEvent, $hWnd, $iObjectID, $iChildID, $iThreadId, $iEventTime) ConsoleWrite(StringFormat('Hook: iEvent[%s] iObjectID[%s] iChildID[%s]', $iEvent, $iObjectID, $iChildID) & @CRLF) #forceref $hEventHook, $iObjectID, $iChildID, $iThreadId, $iEventTime Switch $iEvent Case $EVENT_SYSTEM_MENUPOPUPSTART ConsoleWrite(_WinAPI_GetClassName($hWnd) & @CRLF) Local $pObj = _WinAPI_AccessibleObjectFromEvent($hWnd, $iObjectID, $iChildID) If Not @error Then Local $oObj = ObjCreateInterface($pObj, $sIID_IAccessible, $tagIAccessible) Local $sName, $iCount, $oChildObj Local $tVt_I4 = DllStructCreate($tagVt_I4) $tVt_I4.vt = $VT_I4 SetError($oObj.get_accName($tVt_I4, $sName)) If @error Then $sName = StringFormat("ERR[0x%08x]", @error) ConsoleWrite("MENU: " & $sName & @CRLF) $oObj.get_accChildCount($iCount) Local $pChildObj Local $aChild = _WinAPI_AccessibleChildren($pObj, 0, $iCount) For $i = 0 To UBound($aChild) - 1 $sName = "" $oChildObj = 0 ConsoleWrite("CHILD[" & $i & "]: ") If IsPtr($aChild[$i]) Then ;Child has been retrieved as an object in its own right $oChildObj = ObjCreateInterface($aChild[$i], $sIID_IAccessible, $tagIAccessible) $tVt_I4.data = 0 Else $tVt_I4.data = $aChild[$i] SetError($oObj.get_accChild($tVt_I4, $pChildObj)) Switch @error Case $S_OK ;We shouldn't end up here. AccessibleChildren probably would've retuned a VT_DISPATCH for the child. $oChildObj = ObjCreateInterface($pChildObj, $sIID_IAccessible, $tagIAccessible) $tVt_I4.data = 0 Case $S_FALSE ;Child is an Element (get detials from this object.) $oChildObj = $oObj Case Else ConsoleWrite("ERROR: 0x" & Hex(@error) & @CRLF) ContinueLoop EndSwitch EndIf SetError($oChildObj.get_accName($tVt_I4, $sName)) If (@error < $S_OK) Or @error > $S_FALSE Then ConsoleWrite(ConsoleWrite("ERROR: 0x" & Hex(@error) & @CRLF)) Else ConsoleWrite($sName & @CRLF) EndIf Next EndIf Case $EVENT_SYSTEM_MENUPOPUPEND EndSwitch EndFunc ;==>_EventProc Func _WinAPI_AccessibleObjectFromEvent($hWnd, $iID, $iChildID) Local $tVt_I4 = DllStructCreate($tagVt_I4) Local $aCall = DllCall($__g_hDllOleacc, "long", "AccessibleObjectFromEvent", "hwnd", $hWnd, "dword", $iID, "dword", $iChildID, "ptr*", 0, "struct*", $tVt_I4) If @error Then Return SetError(@error, 0, 0) ConsoleWrite(StringFormat("AccessibleObjectFromEvent: pIAccessible[%s], iChildID[%d]", $aCall[4], $tVt_I4.data) & @CRLF) Return SetError($aCall[0], 0, $aCall[4]) EndFunc Func _WinAPI_AccessibleChildren($pAccessible, $iChildStart, $iCount) Local $tBuff = DllStructCreate(StringFormat("byte data[%d]", $iCount * 24)) Local $aCall = DllCall($__g_hDllOleacc, "long", "AccessibleChildren", "ptr", $pAccessible, "int", $iChildStart, "int", $iCount, "struct*", $tBuff, "long*", 0) If @error Then Return SetError(@error, 0, 0) Local $aChildren[$aCall[5]], $tVt For $i = 0 To $aCall[5] - 1 $tVt = DllStructCreate($tagVt_I4, Ptr(DllStructGetPtr($tBuff) + $i * 24)) If $tVt.Vt = $VT_DISPATCH Then $tVt = DllStructCreate($tagVt_Dispatch, Ptr(DllStructGetPtr($tBuff) + $i * 24)) $aChildren[$i] = $tVt.data If $tVt.Vt = $VT_DISPATCH Then $aChildren[$i] = Ptr($aChildren[$i]) Next ReDim $aChildren[$i] Return SetError($aCall[0], $aCall[5], $aChildren) EndFunc -
_WinAPI_SetWinEventHook() help file example - help
MattyD replied to argumentum's topic in AutoIt GUI Help and Support
OK thanks. I guess I'll find myself a win10 machine tomorrow. -
_WinAPI_SetWinEventHook() help file example - help
MattyD replied to argumentum's topic in AutoIt GUI Help and Support
Fair enough - I just thought we might be pushing the needle a bit into "too convoluted" territory. Hmm, the script is very scruffy at the moment (and also leaky) ... but its not crashing on mine (Win11 24H2). Are you able to elaborate where its dying? I've just been clicking on the top menus and pulling up context menus in notepad. Then clicking on scite menus to test a win32 program... -
_WinAPI_SetWinEventHook() help file example - help
MattyD replied to argumentum's topic in AutoIt GUI Help and Support
I don't really know where I'm going here - but I guess this might be a step in the right direction.. #AutoIt3Wrapper_Au3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #AutoIt3Wrapper_UseX64=Y ;x86 is broken - future Matt's problem!. #include <GuiMenu.au3> #include <SendMessage.au3> #include <WinAPIGdi.au3> #include <WinAPIMisc.au3> #include <WinAPIProc.au3> #include <WinAPISys.au3> #include <WindowsConstants.au3> #include <APIErrorsConstants.au3> Global Const $S_OK = 0, $S_FALSE = 1 Global Enum $VT_EMPTY = 0, _ $VT_I4 = 3, _ $VT_BSTR = 8, _ $VT_DISPATCH = 9 Global Const $sIID_NULL = "{00000000-0000-0000-0000-000000000000}" Global Const $sIID_IDispatch = "{00020400-0000-0000-C000-000000000046}" Global Const $sIID_IUnknown = "{00000000-0000-0000-C000-000000000046}" Global Const $sIID_IAccessible = "{618736e0-3c3d-11cf-810c-00aa00389b71}" ;~ Global Const $sIID_ITypeInfo = "{00020401-0000-0000-C000-000000000046}" ;~ Global Const $sIID_ITypeLib = "{00020402-0000-0000-C000-000000000046}" Global $tagIDiapatch = "GetTypeInfoCount hresult(uint*);" & _ "GetTypeInfo hresult(uint;int;ptr*);" & _ "GetIDsOfNames hresult(struct*;wstr;uint;int;int);" & _ "Invoke hresult(int;struct*;int;word;ptr*;ptr*;ptr*;uint*);" ;Use struct* instead of variant for input. if sending 0 as variant, the value doesn't seem to be sent as VT_I4. (Probably VT_EMPTY) Global $tagIAccessible = $tagIDiapatch & _ "get_accParent hresult(ptr*);" & _ "get_accChildCount hresult(long*);" & _ "get_accChild hresult(struct*;ptr*);" & _ "get_accName hresult(struct*;bstr*);" & _ "get_accValue hresult(struct*;bstr*);" & _ "get_accDescription hresult(struct*;bstr*);" & _ "get_accRole hresult(struct*;variant*);" & _ "get_accState hresult(struct*;variant*);" & _ "get_accHelp hresult(struct*;bstr*);" & _ "get_accHelpTopic hresult(bstr*;struct*;long*);" & _ "get_accKeyboardShortcut hresult(struct*;bstr*);" & _ "get_accFocus hresult(struct*);" & _ "get_accSelection hresult(variant*);" & _ "get_accDefaultAction hresult(struct*;bstr*);" & _ "accSelect hresult(long;struct*);" & _ "accLocation hresult(long*;long*;long*;long*;struct*);" & _ "accNavigate hresult(long;variant;variant*);" & _ "accHitTest hresult(long;long;variant*);" & _ "accDoDefaultAction hresult(struct*);" & _ "put_accName hresult(struct*;bstr);" & _ "put_accValue hresult(struct*;bstr);" Global $hEventProc = DllCallbackRegister('_EventProc', 'none', 'ptr;dword;hwnd;long;long;dword;dword') Global $g_tRECT, $g_iIndex, $g_hMenu = 0 OnAutoItExitRegister('OnAutoItExit') Global $hEventHook = _WinAPI_SetWinEventHook($EVENT_SYSTEM_MENUPOPUPSTART, $EVENT_SYSTEM_MENUPOPUPEND, DllCallbackGetPtr($hEventProc)) Global $iNotepad_PID = ShellExecute('notepad.exe') While ProcessExists($iNotepad_PID) Sleep(1000) WEnd Func OnAutoItExit() _WinAPI_UnhookWinEvent($hEventHook) DllCallbackFree($hEventProc) EndFunc ;==>OnAutoItExit Func _EventProc($hEventHook, $iEvent, $hWnd, $iObjectID, $iChildID, $iThreadId, $iEventTime) ConsoleWrite(StringFormat('hHook[%s] iEvent[%s] hWnd[%s] iObjectID[%s] iChildID[%s] $iThreadId[%s] iEventTime[%s]', $hEventHook, $iEvent, $hWnd, $iObjectID, $iChildID, $iThreadId, $iEventTime) & @CRLF) #forceref $hEventHook, $iObjectID, $iChildID, $iThreadId, $iEventTime Switch $iEvent Case $EVENT_SYSTEM_MENUPOPUPSTART ConsoleWrite(_WinAPI_GetClassName($hWnd) & @CRLF) Local $pObj = _WinAPI_AccessibleObjectFromEvent($hWnd, $iObjectID, $iChildID) If Not @error Then Local $oObj = ObjCreateInterface($pObj, $sIID_IAccessible, $tagIAccessible) Local $sName, $iCount, $oChildObj Local $tVt_I4 = DllStructCreate("align 2;ushort vt;word Pad[3];int int") $tVt_I4.vt = $VT_I4 SetError($oObj.get_accName($tVt_I4, $sName)) If @error Then $sName = StringFormat("ERR[0x%08x]", @error) ConsoleWrite("MENU: " & $sName & @CRLF) $oObj.get_accChildCount($iCount) Local $pChildObj Local $aChild = _WinAPI_AccessibleChildren($pObj, 0, $iCount) For $i = 0 To UBound($aChild) - 1 $sName = "" $oChildObj = 0 ConsoleWrite("CHILD[" & $i & "]: ") If IsPtr($aChild[$i]) Then ;Child has been retrieved as an object in its own right $oChildObj = ObjCreateInterface($aChild[$i], $sIID_IAccessible, $tagIAccessible) $tVt_I4.Int = 0 Else $tVt_I4.Int = $aChild[$i] SetError($oObj.get_accChild($tVt_I4, $pChildObj)) Switch @error Case $S_OK ;We shouldn't end up here. AccessibleChildren probably would've retuned a VT_DISPATCH for the child. $oChildObj = ObjCreateInterface($pChildObj, $sIID_IAccessible, $tagIAccessible) $tVt_I4.Int = 0 Case $S_FALSE ;Child is an Element (get detials from this object.) $oChildObj = $oObj Case Else ConsoleWrite("ERROR: 0x" & Hex(@error) & @CRLF) EndSwitch EndIf SetError($oChildObj.get_accName($tVt_I4, $sName)) If (@error < $S_OK) Or @error > $S_FALSE Then ConsoleWrite(ConsoleWrite("ERROR: 0x" & Hex(@error) & @CRLF)) Else ConsoleWrite($sName & @CRLF) EndIf Next EndIf Case $EVENT_SYSTEM_MENUPOPUPEND EndSwitch EndFunc ;==>_EventProc Func _WinAPI_AccessibleObjectFromEvent($hWnd, $iID, $iChildID) Local $tVt_I4 = DllStructCreate("align 2;ushort vt;word Pad[3];int int") Local $aCall = DllCall("Oleacc.dll", "long", "AccessibleObjectFromEvent", "hwnd", $hWnd, "dword", $iID, "dword", $iChildID, "ptr*", 0, "struct*", $tVt_I4) If @error Then Return SetError(@error, 0, 0) ConsoleWrite(StringFormat("AccessibleObjectFromEvent: pIAccessible[%s], iChildID[%d]", $aCall[4], $tVt_I4.int) & @CRLF) Return SetError($aCall[0], 0, $aCall[4]) EndFunc Func _WinAPI_AccessibleChildren($pAccessible, $iChildStart, $iCount) Local $tagVt_Dispatch = "align 2;ushort vt;word Pad[3];dword_ptr data" Local $tagVt_I4 = "align 2;ushort vt;word Pad[3];int data" Local $tBuff = DllStructCreate(StringFormat("byte data[%d]", $iCount * 24)) Local $aCall = DllCall("Oleacc.dll", "long", "AccessibleChildren", "ptr", $pAccessible, "int", $iChildStart, "int", $iCount, "struct*", $tBuff, "long*", 0) If @error Then Return SetError(@error, 0, 0) Local $aChildern[$aCall[5]], $tVt For $i = 0 To $aCall[5] - 1 $tVt = DllStructCreate($tagVt_I4, Ptr(DllStructGetPtr($tBuff) + $i * 24)) If $tVt.Vt = $VT_DISPATCH Then $tVt = DllStructCreate($tagVt_Dispatch, Ptr(DllStructGetPtr($tBuff) + $i * 24)) $aChildern[$i] = $tVt.data If $tVt.Vt = $VT_DISPATCH Then $aChildern[$i] = Ptr($aChildern[$i]) Next ReDim $aChildern[$i] Return SetError($aCall[0], $aCall[5], $aChildern) EndFunc Is the aim just to get a general demonstration of _WinAPI_SetWinEventHook() for the helpfile?? To @WildByDesign's point, maybe we should just do something simple that's easy to follow? -
_WinAPI_SetWinEventHook() help file example - help
MattyD replied to argumentum's topic in AutoIt GUI Help and Support
Hey Mate, I'd say MN_GETHMENU is probably a non-starter because this is not your traditional Win32 menu anymore. In the hook, we probably used to see: $iObjectID = $OBJID_MENU (-4) _WinAPI_GetClassName($hWnd) = "#32768" (menu class) but with the new notepad we now get: _WinAPI_GetClassName($hWnd) = "Windows.UI.Input.InputSite.WindowClass" So not too sure what we can do with that... -
Hi all, Apologies in advance if this is a bit unclear - I'll post a follow up at some point to help demonstrate. It seems we should be able initialise the runtime a bit better by distributing Microsoft.WindowsAppRuntime.Bootstrap.dll: firstly install Microsoft.WindowsAppRuntime.1.7.msix (refer to post #1), then in the code: ;From WindowsAppSDK-VersionInfo.h Global Const $WINDOWSAPPSDK_RELEASE_MAJORMINOR = 0x00010007 Global Const $WINDOWSAPPSDK_RELEASE_VERSION_TAG = "" Global Const $WINDOWSAPPSDK_RUNTIME_VERSION_UINT64 = 0x1B58020A05A40000 ;"7000.522.1444.0" Global Enum $MddBootstrapInitializeOptions_None, _ $MddBootstrapInitializeOptions_OnError_DebugBreak, _ $MddBootstrapInitializeOptions_OnError_DebugBreak_IfDebuggerAttached, _ $MddBootstrapInitializeOptions_OnError_FailFast, _ $MddBootstrapInitializeOptions_OnNoMatch_ShowUI, _ $MddBootstrapInitializeOptions_OnPackageIdentity_NOOP Global $__g_hDllWinAppRTBootStrap = DllOpen("Microsoft.WindowsAppRuntime.Bootstrap.dll") Local $aCall = DllCall($__g_hDllWinAppRTBootStrap, "long", "MddBootstrapInitialize2", _ "uint", $WINDOWSAPPSDK_RELEASE_MAJORMINOR, _ "wstr", $WINDOWSAPPSDK_RELEASE_VERSION_TAG, _ "uint64", $WINDOWSAPPSDK_RUNTIME_VERSION_UINT64, _ "uint", $MddBootstrapInitializeOptions_None) I believe that ShowUI flag is supposed to bring up a dialog if the runtime doesn't exist... but for me this just crashes the script. The "none" flag does work ok though, and will return a sensible error on failure. So how does this help? It means we don't need to manually load the dlls in - and instead of directly calling DllGetActivationFactory on individual Dll files (which was a bit hacky), the normal system call - RoGetActivationFactory starts to work. This is important because some objects were failing to create with the "Class not registered" error. I'd say these ones were internally trying to call GetActivationFactory for dependencies etc... Edit - PS: I've nabbed the bootstrap dll from the Microsoft.WindowsAppSDK nuget package. Its a bit annoying to get, so I've attached it here. But to get it manually: https://www.nuget.org/packages/Microsoft.WindowsAppSDK/ Download (on the right) .nupkg file. extract contents... look in: .\microsoft.windowsappsdk.1.7.250606001\runtimes\win-x64\native\ Microsoft.WindowsAppRuntime.Bootstrap.dll
-
Thanks for that Gianni I've amended the instructions. Its interesting that x86 is broken, I'll have to have a look at that at some stage! A new test script is now up there, "WindowTest.au3" should be the only modified file. There's just some initial attempts at handling window messages for the main window.