Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Installing a printer driver programmatically
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Installation et configuration
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows Server 2003
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
00984245
Message ID:
00984269
Vues:
12
Thanks Lisa! I found this after some more googling earlier today...

Actually I think you have to both register the driver and then install it using an INF file. Otherwise the printer doesn't end up in the Printers list.

http://west-wind.com/weblog/posts/1440.aspx


+++ Rick ---

>Yes there is a way.
>
>Forgive me for pulling this code directly out of one of my Listener classes, Rick, I'm kind of in a rush, but you will see what you need to do. Of course the running user has to have admin permissions, but that's probably true of the rest of your process.
>
>You can use code like this in a batch file calling during a setup EXE's processing, FWIW. I just happen to have this example from a class handy. The critical part is what you see in the lcCmd variable.
>
>
>
>   PROCEDURE VerifyPrinterSetup()
>
>      PRIVATE laSetups[1]
>
>      LOCAL lcCmd, lcFailureConditions
>
>      lcFailureConditions = ;
>       " APRINTERS(laSetups) = 0 OR " + ;
>       " ASCAN(laSetups,[" + ;
>       THIS.PSDriverSetupName+"],1,ALEN(laSetups,1),1,7) = 0 "
>
>      * check for the existance of the appropriate printer driver
>      * if it is not there, attempt to install
>      * if it is not installed after attempt,
>      * return .F.
>
>     IF &lcFailureConditions.
>
>        THIS.DoStatus(INSTALLING_DRIVER_LOC)
>
>        lcCmd = ;
>        [%windir%\\system32\\rundll32.exe  ] + ;
>        [printui.dll,PrintUIEntry /if /b ] + ;
>        ["] + THIS.PSDriverSetupName + ["] + ;
>        [ /f %windir%\\inf\\ntprint.inf /r  "lpt1:" /m "] + ;
>        DRIVER_TO_USE + [" /Z]
>
>        llReturn = ;
>         THIS.oWinAPI.ProgExecute( ;
>             lcCmd,lcFailureConditions,THIS.WaitAttempts)
>
>        THIS.ClearStatus()
>
>     ENDIF
>
>     RETURN APRINTERS(laSetups) > 0 AND ;
>        ASCAN(laSetups,THIS.PSDriverSetupName,1,ALEN(laSetups,1),1,7) > 0
>
>   ENDPROC
>
>
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform