Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 3189

Re: PrintToPrinter doesn't work when printing from a windows service in a virtual machine

$
0
0

I had some problems with this myself.  As Don said, my issue had to do with the system account not knowing about the printers.  I handled it at runtime by writing a piece of code that copied a registry tree hierarchy then invoked it as follows.  Params are from and to.

 

// Network

copyRegistryTree(HKEY_CURRENT_USER, "Printers\\Connections",

                 HKEY_USERS, ".Default\\Printers\\Connections");

 

// Local

copyRegistryTree(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows NT\\CurrentVersion\\Devices",

                 HKEY_USERS, ".Default\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Devices");

copyRegistryTree(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows NT\\CurrentVersion\\PrinterPorts",

                 HKEY_USERS, ".Default\\Software\\Microsoft\\Windows NT\\CurrentVersion\\PrinterPorts");

copyRegistryTree(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows",

                 HKEY_USERS, ".Default\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows");


Viewing all articles
Browse latest Browse all 3189

Trending Articles