Jump to content

Recommended Posts

Posted

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!  👍

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Posted

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.

  • 2 weeks later...
Posted (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:

Microsoft.WindowsAppRuntime.Bootstrap.dll

Edited by MattyD
Posted (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 by MattyD
Posted

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

Posted

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.

Posted

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!

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...