Checking installed printers
The program I'm installing routes printouts to the default printer. During the course of the installation, if there are NO printers installed, I'd like to (optionally) run the Add Printer wizard. If there are MULTIPLE printers installed, I'd like to open the Printers folder so the user can verify their default. (Or maybe if I can read the name of the default printer, that'd be better).
Here's what I have so far:
Section "-Check for printers"
EnumRegValue $0 HKCU "Software\Microsoft\Windows NT\CurrentVersion\Devices" 0
IfErrors +2
Goto done
MessageBox MB_YESNO "You do not have any printers installed. Would$\n\
you like to run the Add Printer wizard now?" IDNO +2
ExecWait 'RunDll32.exe SHELL32.DLL,SHHelpShortcuts_RunDLL AddPrinter'
done:
SectionEnd
Section "-Open Printers Folder"
EnumRegValue $0 HKCU "Software\Microsoft\Windows NT\CurrentVersion\Devices" 1
IfErrors done
MessageBox MB_YESNO "MCPPRT will route mainframe printouts to your default printer.$\n\
Would you like to open the Printers folder to check your default?" IDNO +2
ExecWait 'RunDll32.exe SHELL32.DLL,SHHelpShortcuts_RunDLL PrintersFolder'
done:
SectionEnd
Is this the best method? Is there another method that will work on Windows 98 *and* XP? Are there any conditions under which this wouldn't work?