question

VigneshGovindhan-1617 avatar image
0 Votes"
VigneshGovindhan-1617 asked Castorix31 answered

Printing a file in Windows App SDK (tested printing thought processstartinfo with verb print) its not working

I am migrating my app from UWP to WinUI 3 in Desktop with windows app sdk. I used to print using print manager in uwp.

So printing a file in Windows App SDK by printing thought processstartinfo with verb "print" its not working. is this a right way to print or are they any API's specific to Windows App SDK

windows-app-sdk-winui3windows-app-sdk-general
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Castorix31 avatar image
0 Votes"
Castorix31 answered

This test with a "e:\test.txt" file works for me in a Windows App SDK C++ Desktop app :

At beginning :

 #pragma comment (lib, "Shell32")

Then :

 ShellExecute(0, L"open", L"rundll32.exe", L"C:\\windows\\system32\\mshtml.dll, PrintHTML \"e:\\test.txt\"", NULL, SW_SHOWNORMAL);

("print" or "printto" verbs with the file instead of "open" can also be used, but it depends on registry associations)


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.