1

As the title suggests I am curious to discover a programmatic solution that allows for WIN32 desktop applications to resume a suspended UWP application. I am writing a small process management app that allows for suspending & resuming processes however metro applications simply don't respond to the Win32 API calls to SuspendThread and ResumeThread. Does anyone know how to resume a UWP application from a Desktop application? Any hints here would be greatly appreciated! Thank you

Stefan Wick MSFT
  • 13,600
  • 1
  • 32
  • 51

1 Answers1

2

You can resume a suspended app using the AppResourceGroupInfo.StartResumeAsync API. This can be called either from a desktop app, or a UWP app. When calling from a UWP app you need to declare the appDiagnostics capability.

https://learn.microsoft.com/en-us/uwp/api/windows.system.appresourcegroupinfo.startresumeasync

Martin Zikmund
  • 38,440
  • 7
  • 70
  • 91
Stefan Wick MSFT
  • 13,600
  • 1
  • 32
  • 51
  • Hi Stefan, your information is much appreciated. Do you happen to have any Win32 app calling example, i.e> using GetProcAddress(LoadLibrary()) on whichever assembly needs to be loaded? Ultimately I'd like to do this from a Win32 c++ application – JohnnyRogers Jul 31 '19 at 19:20
  • LoadLibrary isn't the way to go here. This is a WinRT API. Here is an older blog post explaining how to call those from a Win32 app. This still works roughly the same way in new versions of VS, too. https://blogs.windows.com/windowsdeveloper/2017/01/25/calling-windows-10-apis-desktop-application/ – Stefan Wick MSFT Aug 01 '19 at 02:03
  • Thanks Stefan I appreciate the information you've provided me – JohnnyRogers Aug 01 '19 at 03:43
  • @StefanWickMSFT I'm trying this from a WPF app and it just doesn't do anything. Pretty sure [my code](https://dotnetfiddle.net/nwbSMj) is fine because if I switch it to StartSuspendAsync() and have it called while the UWP app is in foreground, that actually works just fine. Does the target UWP app require the appDiagnostics capability? – Sean O'Neil Dec 12 '19 at 07:47
  • @SeanO'Neil Not sure why this doesn't work. Might be best to start a new question and include repro details. – Stefan Wick MSFT Dec 12 '19 at 16:57