Popular Post MattyD Posted July 8 Popular Post Posted July 8 (edited) Hi all - This is an offshoot of the WinRT Project. I'm posting my progress here while I'm bumbling around with WinUI3 - just so the main project doesn't get too cluttered. If I get things working I'll merge the two projects back together. That's the plan anyway! Theres not much there at the moment, but if you wish to try it out you'll need to: download and extract the example (The attachment it too big for here, so I've popped it in sourceforge) Go here and download the latest Redistributable package of the Windows App SDK. Currently this is 1.7.3 (look in the table for the link.). Once you've extracted that, go to the MSIX > win10-x64 folder and install Microsoft.WindowsAppRuntime.1.7.msix It seems the x86 libraries don't work at the moment. (thanks for testing Gianni) Progress so far... Cheers, Matt Edited 17 hours ago by MattyD argumentum, WildByDesign, Gianni and 2 others 5
Gianni Posted July 9 Posted July 9 Hi @MattyD 16 hours ago, MattyD said: I also installed the msix (this is a runtime afterall!) - I'm not sure if this step is strictly necessary for now. Maybe someone could check? ... I didn't install it, and "WindowTest.au3" works anyway ... 16 hours ago, MattyD said: yes, you can probably the x86 libraries - but I haven't tested them... be sure to alter the "#AutoIt3Wrapper_UseX64" directive in WindowTest.au3 if you plan to go down that path. ... I also tried this stuff but it doesn't work ... I get this --> !>01:19:22 AutoIt3.exe ended.rc:-1073741819 Thanks for all this work! 👍 MattyD 1 Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....
MattyD Posted July 10 Author Posted July 10 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. Gianni 1
MattyD Posted July 21 Author Posted July 21 (edited) 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 Edited July 21 by MattyD
MattyD Posted Saturday at 01:14 PM Author Posted Saturday at 01:14 PM (edited) 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) Edited Saturday at 01:44 PM by MattyD
MattyD Posted 16 hours ago Author Posted 16 hours ago 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
WildByDesign Posted 15 hours ago Posted 15 hours ago I appreciate the work that you are doing on this. It's interesting to follow your progress as well. I have to admit, I really like the look of that button. I had never really thought much of WinRT or WinUI3 before but it's got my attention now. One interesting thing: You can't see the button with the default Windows Dark theme. You can see the button with Windows Light theme and just about any other theme. But not default Dark theme for some reason. I suppose there must be more to the WinUI3 theming and theme detection but I don't understand it at all yet. MattyD 1
MattyD Posted 5 hours ago Author Posted 5 hours ago 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! WildByDesign 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now