DennisFeiock
2nd December 2005 13:57 UTC
Reading/Setting Default Printer
Hi all,
I was wondering if anyone knows how to find and change a user's default printer using NSIS? Preferably without using command line tools, since my script is attempting a printer migration for all users on the PC directly via the registy.
My search didnt come up with any results.
Thanks,
- Dennis Feiock
kichik
2nd December 2005 14:25 UTC
You can call SetDefaultPrinter and GetDefaultPrinter using the System plug-in.
System::Call 'winspool::GetDefaultPrinter(t .r0, *i ${NSIS_MAX_STRLEN})'
MessageBox MB_OK $0
But those aren't supported on Windows 9x. I think on Windows 9x, this is saved in WIN.INI.
DennisFeiock
2nd December 2005 14:30 UTC
kichik,
Thanks for the input. I'm afraid that system calls in this scenario are not going to work out well.
My script migrates the printers for all users on the PC using the EnumUsersReg include and converting them under HKU\SID\Printers\Connections.
I will be using PsExec to push out the executable, which runs it as the Local Service account. Thus, system calls would only make the necessary changes for that one account.
Any ideas specific registry changes that can be made to have the same result?
Thanks,
- Dennis
kichik
2nd December 2005 14:42 UTC
First Google result for "default printer registry" came up is:
http://www.winguides.com/registry/display.php/279/
That seems like what you're looking for.