Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

Python AppLifecycle single instance

This Windows App SDK sample launches two Python processes and demonstrates:

  • registering a primary instance with AppInstance;
  • retrieving the second process's activation arguments;
  • redirecting activation asynchronously to the primary process; and
  • receiving and unsubscribing from the typed Activated event.

Prerequisites

  • Microsoft.Windows.AppLifecycle.winmd;
  • a newline-separated reference-WinMD list for the matching Windows App SDK;
  • the matching architecture's bootstrap DLL;
  • dynwinrt installed in the selected Python interpreter; and
  • dynwinrt-codegen on PATH, or passed with -Codegen.

Run

.\generate.ps1 `
  -AppLifecycleWinmd C:\fixtures\Microsoft.Windows.AppLifecycle.winmd `
  -RefList C:\fixtures\winmd-reference-list.txt `
  -BootstrapDll C:\fixtures\x64\Microsoft.WindowsAppRuntime.Bootstrap.dll `
  -Codegen ..\..\..\target\release\dynwinrt-codegen.exe

.\run.ps1 -Python C:\path\to\python.exe -Major 2 -Minor 3

Major and Minor default to 2 and 3. They must exactly match the Windows App SDK product version represented by the metadata, bootstrap DLL, and installed runtime.

The loopback succeeds only after the secondary process redirects its launch activation and the primary receives it. It prints python-app-lifecycle-ok.