>It's possible by code to install a printer, having driver.
>I need to automate the printer setup, for a tiff driver,
>I have all the driver needed for installation.
>
>Some Idea ?
Check out the create process FAQ by ShellExecute API function..
If there is a setup.exe, just run it fine.
If there is ONLY xxx.inf, you need to make the Command line call:
C:\WINDOWS\rundll.exe
setupx.dll,InstallHinfSection DefaultInstall 132 %1 (Where %1 is the inf file name, lpszParams is the bold part..)
declare long ShellExecute in "shell32.dll" long hwnd, string lpszOp, ;
string lpszFile, string lpszParams, ;
string lpszDir, long nShowCmd
declare long GetDesktopWindow in "win32api"
local hDCScreen
hDCScreen = GetDesktopWindow()
this.Value = ShellExecute( hDCScreen, ;
this.mcOperation, ;
this.mcDocApp, ;
this.mcParameters, ;
this.mcDefaultDir, ;
this.mnShowCommand )
Note: Only exe file allow passing Parameters in ShellExecute, Other extension fail to do.
Anyway, this is partical self-installation, user need to fill in detail to complete the installation.....
If you really want the installation is completely Done by coding,
You need to take a look sleep, mouse_event and keyboard_event API call,
which can simulate all user key-in, mouse-in action to do install.
But, the chance to generate error is very high,
such as user also key-in within the simulation of keyboard events.
Therefore, it is NOT recommended.
The weak wait for chance, The strong bid for chance,
The clever notch up chance, but The merciful give you chance.