Jump to content

Recommended Posts

Posted

Thank you as always!

2 hours ago, WildByDesign said:

What happens in the case of version mismatches between the bootstrapper DLL and the Windows App SDK that a user has on their machine?

I think it should be OK. It'll just try to load a requested runtime version - and it'll either succeed or fail. 

A few posts back, we found MddBootstrapInitialize2 reported success when the installed runtime differed from what we requested,  but the runtime didn't actually initialize.  So in response to that,  _WinUI3_Startup() now attempts to retrieve a version number to verify all is OK before returning success.

By memory, loading the "2.0 experimental3" version worked fine with our current bootstrapper, so I don't think its critical to keep this dll up to date.  But it might be worth double checking I guess. Either way I'll keep the dll up to date in the WinRT releases.

Also - the default runtime version that _WinUI3_Startup() targets is static, and that will change depending on the WinRT release.  This is because all our WinUI3 libraries are generated from one WinAPPSDK version, and so _WinUI3_Startup is setup to target that.  I'll pop an announcement up whenever the default version changes (I'll probably release whenever a new stable SDK drops), but there's certainly no plans to support parallel versions of the SDK!!!

3 hours ago, WildByDesign said:

. I've never fully understood where (or when) end users get updates to the Windows App SDK platform.

yeah generally end users don't. It's our responsibility as developers to distribute the runtime along with our software. (Multiple versions can co-exist).

This is probably worth a read around distribution, if we ever make it that far!
https://learn.microsoft.com/en-us/windows/apps/windows-app-sdk/deploy-unpackaged-apps

3 hours ago, WildByDesign said:

I feel like it's kind of unfortunate that MS doesn't store that bootstrapper DLL anywhere on a user's machine

yeah, a decision was made obviously made at some point to decouple the WinUI stuff from the OS. So lucky us I guess!

Posted (edited)

Hi guys, just FYI. 

Here's how the "override-able interfaces" stuff is currently looking for the next WinRT release.

In WinRT.au3...

  •  _WinRT_CreateOverridesObj($pFactory, $ahFunctions, $sOverriddenIID)
    • $pFactory must be a pointer to a "composable" interface.
    • The $ahFunctions param must be an array of handles returned from DllCallbackRegister().
    • The order is important - it must match the v-table of the interface that we're overriding.  (do not include IUnknown and IInspectable methods, these are handled internally)
  • _WinRT_DestroyOverridesObj($pOverrides, $bFreeCalbacks = True)

    • ATM the $pOverrides must be the same pointer as that returned by _WinRT_CreateOverridesObj. So be careful when using _WinRT_SwitchInterface() - it'll change your object pointer as you're flicking between interfaces!

    • By default DestroyOverridesObj frees the callbacks that were provided on creation of the object.  If we're using one function for multiple objects for eg., you may need to suppress this behavior by setting  $bFreeCalbacks to False.  (I may yet reverse the default setting for the param... I'll probably need to play with other objects with a few more override-able methods before deciding!)

    • The IUnknown/IInspectable funcs again are managed internally, and are not affected by the $bFreeCalbacks param.

And in WinRT_WinUI3.au3 there's a special func for OnLaunched().

  • _WinUI3_StartApp($sOnLaunchedFunc)
    • $sOnLaunchedFunc is the user function to be executed on Launch
    • The user func must have 2 params to receive the 2 objects..
      • Microsoft.UI.Xaml.Application
      • Microsoft.UI.Xaml.LaunchActivatedEventArgs pEventArgs
    • _WinUI3_StartApp will also call IApplicationStatics_Start() to kick off the dispatch loop. (for now anyway!)
      • I might take this part out if its necessary to do more stuff on the statics interface before launching!

ATM it looks kinda like this...

#include "..\Include\WinRT.au3"
#include "..\Include\WinRT_WinUI3.au3"
#include "..\Include\Classes\Microsoft.UI.Xaml.Application.au3"
#include "..\Include\Classes\Microsoft.UI.Xaml.LaunchActivatedEventArgs.au3"
#include "..\Include\Classes\Microsoft.UI.Xaml.Window.au3"

_WinRT_Startup()
_WinUI3_Startup()
_WinUI3_StartApp("OnLaunched")
_WinUI3_Shutdown()
_WinRT_Shutdown()

Func OnLaunched($pApplication, $pEventArgs)
    Local $pWindow = _WinRT_ActivateInstance("Microsoft.UI.Xaml.Window")
    _WinRT_SwitchInterface($pWindow, $sIID_IWindow)
    IWindow_Activate($pWindow)
EndFunc
Edited by MattyD

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
×
×
  • Create New...