I have an application that uses an old reporting library (ReportPro). On Windows 7 64, it sometimes fails to find the default printer. I did some digging and found the problem in the windows registry. ReportPro determines the available printers via the GetProfileString windows API. It gets a list of available printers from here:
HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Devices
It gets the default printer from here:
HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows\Device
What I'm seeing in the windows registry is the the list of printers will show the name and the network port we are using as:
HP LaserJet 5200 Series PCL 5 on Ne03:
Microsoft XPS Document Writer on Ne01:
HP Officejet Pro K8600 Series on Ne02:
Phaser 8860-2 PS on Ne00:
CutePDF Writer on CPW2:
On some systems the value of the default printer string is different. It would be something like:
HP LaserJet 5200 Series PCL 5 on Ne01:
In particular the NExx number is different in the default printer value compared to the list of printers.
The report package fails to find a default printer as it uses the printer name and the NExx number in the comparison.
Why would the NExx values be different and how do I make sure the values "stick"? The solution I have found for the moment is to set a different printer as default and then choose the correct default printer. That seems to resolve the problem temporarily but it is not permanent.
This problems seems to be Win7 only. Several of the XP machines have never had this problem in the last 8 years.