PDA

View Full Version : Always about automatically printer's installation



Fefo77
09-01-2003, 05:13 AM
Hi everybody!

Using the "LaunchAppAndWait" function with the correct parameters ("rundll32.exe" and "shell32.dll,SHHelpShortcuts_RunDLL AddPrinter") I obtain an automatically printer's installation (the "famous" <silent installation>).

The problem is that in folder "Settings" -> "Printers" I don't see my printer, but if I try to do the same operation manually, Windows alert me that printer is already loaded in the system. Does anibody know if there is a way to see my printer in folder "Settings" -> "Printers"?

Thanks!

Federico Magi
Help Desk
DATA PRINT GRAFIK
DIVISIONE SMART FORMS
www.smtforms.com
f.magi@smtforms.com

ursvenky
09-02-2003, 05:44 AM
Hi,
I guess you need to restart the spooler
For this there are 2 solutions.
1. Go to command lind
2. Type "net stop spooler"
3. Click enter
4. Type "net start spooler"

Using Install script what you can do is

prototype INT Shell.ShellExecute( HWND, BYREF STRING, BYREF STRING, BYVAL STRING, BYVAL STRING, INT );

prototype INT Shell32.ShellExecuteA( HWND, BYREF STRING, BYREF STRING, BYVAL STRING, BYVAL STRING, INT );

HWND hwndSetup;

if ( UseDLL("Shell32.dll") = 0 )then
hwndSetup= GetWindowHandle( HWND_INSTALL);
ShellExecuteA( hwndSetup, "open", "net.exe", "stop spooler", WINSYSDIR, SW_HIDE );
UnUseDLL("Shell32.dll");
else
if( UseDLL("Shell.dll")=0)then
ShellExecute( hwndSetup, "open", "net.exe", "stop spooler", WINSYSDIR, SW_HIDE );
UnUseDLL("Shell.dll");
endif;
endif;


if ( UseDLL("Shell32.dll") = 0 )then
hwndSetup= GetWindowHandle( HWND_INSTALL);
ShellExecuteA( hwndSetup, "open", "net.exe", "start spooler", WINSYSDIR, SW_HIDE );
UnUseDLL("Shell32.dll");
else
if( UseDLL("Shell.dll")=0)then
ShellExecute( hwndSetup, "open", "net.exe", "start spooler", WINSYSDIR, SW_HIDE );
UnUseDLL("Shell.dll");
endif;
endif;

Note: This solution only works for Windows NT on Windows 98 you need to restart the machine.
First try it manually as I explained in the top if it works and if you have any doubts in the code get back to me so that I can send the solution files.

All the Best

Fefo77
09-08-2003, 03:21 AM
Thank you ursvenky!

I'll try your solution as soon as possible.
For me at the moment the problem remains that with the following function

(LaunchAppAndWait(szProgram2 , szParam2, WAIT )

where

szProgram2 = "Rundll32.exe";
szParam2 = "setupapi.dll,InstallHinfSection DefaultInstall 132 " + SUPPORTDIR + "namefile.inf";

the silent-installation of my printer's driver it does not happen!

You (and everybody!) have some suggestion for me about it??

Thanks in advance!

Federico Magi
Help Desk
DATA PRINT GRAFIK
DIVISIONE SMART FORMS
www.smtforms.com
f.magi@smtforms.com