Environment: Windows NT 4
The Problem
Have you ever attempted to print from a Windows NT Service?
Some time ago my colleagues and I wrote a TCP/IP server to collect
data, analyze it and then print exceptions. Obviously, printing is usually a very
simple and typical task for any software engineer.
When I finished developing this application, I then converted it to a Windows NT service.
Everything seemed to work well with one exception. The application wouldn’t print
anything!
With my heart in my hands, I then began the arduous task of walking the registry
and searching for a solution. Finally, I found it after a few days.
The solution
- Locate the following registry key
- Write down the value of "Device" as you’ll be using it soon
- Locate the following registry key
- Copy the previous information into the field "Device"
- Reboot your PC
HKEY_CURRENT_USERSoftwareMicrosoftWindowsNTCurrentVersionWindows
HKEY_USERS.DEFAULTSoftwareMicrosoftWindowsNTCurrentVersionWindows
That’s it! Now you can print from a Windows NT service.
Warning!
Modifing your registry incorrectly can result in serious, system-wide problems.
Therefore, use this advice at your own risk.
Acknowledgements
Thanks to my friend Maurizio Picco for his usefull help.