Sample call to Print a test page using the default printer in the local machine: var result = PrintTestPage(null, null) The method returns 0 if successful and throws an exception if the Printer is not found. String MachineName: the name of a Machine in the Network or null to use the LocalMachine name. String PrinterName: the name of a specific Printer or null to use the default Printer. ![]() This gives means to correct/adapt the code to specific contexts, when necessary.Īlso, the helper methods here can be reused to initialize any other WMI query.įor example, a wrong Impersonation option, will result in an exception ( 0x80070005: (E_ACCESSDENIED)) when connecting to the WMI Scope or when the WMI query is executed.Ī description of the PrintTestPage method parameters: ![]() Now, this method might look verbose, but I think it's important, when calling WMI methods, that the Management Options and Scopes are defined correctly.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |