MCPcopy Create free account
hub / github.com/MicrosoftEdge/WebView2Samples / GetPrinterName

Method GetPrinterName

SampleApps/WebView2APISample/AppWindow.cpp:1259–1278  ·  view source on GitHub ↗

Function to get printer name by displaying printer text input dialog to the user. User has to specify the desired printer name by querying the installed printers list on the OS to print the web page. You may also choose to display printers list to the user and return user selected printer.

Source from the content-addressed store, hash-verified

1257// OS to print the web page. You may also choose to display printers list to the user and return
1258// user selected printer.
1259std::wstring AppWindow::GetPrinterName()
1260{
1261 std::wstring printerName;
1262
1263 TextInputDialog dialog(
1264 GetMainWindow(), L"Printer Name", L"Printer Name:",
1265 L"Specify a printer name from the installed printers list on the OS.", L"");
1266
1267 if (dialog.confirmed)
1268 {
1269 printerName = (dialog.input).c_str();
1270 }
1271 return printerName;
1272
1273 // or
1274 //
1275 // Use win32 EnumPrinters function to get locally installed printers.
1276 // Display the printer list to the user and get the user desired printer to print.
1277 // Return the user selected printer name.
1278}
1279
1280// Function to get print settings for the selected printer.
1281// You may also choose get the capabilties from the native printer API, display to the user to

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected