How to programmatically close the print interface in a Windows 10 app?

I am developing a Windows 10 universal app using this https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/Printing/cs repository as a guide. I currently have fully functional printing by calling:

await Printmanager.ShowPrintUIAsync(); 

      

My app also has an activity timer that logs a user after some time of inactivity. This part works fine, but I cannot close the ui print on logout.

Note. Typically, to close asynchronous Windows operations, you can do something similar to:

IAsyncOperation<bool> printOperation = Printmanager.ShowPrintUIAsync();
printOperation.Cancel();

      

This works for other AsyncOperation events, but I cannot get it to work for the print UI as the print UI is not a child process of the application, but is a standalone process in and of itself

Thanks in advance!

Also, it looks like there was a solution to kill processes in Windows 8 that are no longer supported in Windows 10 apps (Process.GetProcessByName .... or FindWindow)

Maybe there is some way to kill the Windows 10 process by name?

+3


source to share


1 answer


You cannot do this.

All Metro style apps run in a highly sandboxed environment and there is no way to directly run an external app. Taken from this article

maybe the solution is creating a proxy. How to launch an external program from the Metro app



This can help you because you can kill the process indirectly.

Hope this helps.

+1


source







All Articles