BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Installing printer drivers from within an application using

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Native API)
View previous topic :: View next topic  
Author Message
Terry
Guest





PostPosted: Thu May 05, 2005 7:02 pm    Post subject: Installing printer drivers from within an application using Reply with quote



I need to install device drivers, such as printer driver
automatically from my program. Does anyone have any suggestions on
how to execute the functions inside an .INF file?

Terry
Back to top
Ed Mulroy [TeamB]
Guest





PostPosted: Thu May 05, 2005 7:51 pm    Post subject: Re: Installing printer drivers from within an application us Reply with quote



Try ShellExecute

.. Ed

"Terry" <unknown (AT) unknown (DOT) com> wrote

Quote:
I need to install device drivers, such as printer driver
automatically from my program. Does anyone have any suggestions on
how to execute the functions inside an .INF file?

Terry



Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Thu May 05, 2005 7:58 pm    Post subject: Re: Installing printer drivers from within an application us Reply with quote




"Terry" <unknown (AT) unknown (DOT) com> wrote


Quote:
I need to install device drivers, such as printer driver
automatically from my program. Does anyone have
any suggestions on how to execute the functions inside
an .INF file?

Use the ShellExecute() function, specifying "install" for the lpOperation
parameter.


Gambit



Back to top
Terry
Guest





PostPosted: Fri May 06, 2005 2:05 am    Post subject: Re: Installing printer drivers from within an application us Reply with quote

Here is what I used, but it doesn't seem to do anything. I don't see the
..dll files copied to where they would normally be.

ShellExecute(NULL, "Install", "d:\test\hp201ip5.inf", NULL, NULL,
SW_SHOWNORMAL);

All of the install files are in the d:test directory. However, the INF
file has a section called SourceDisksName.x86, parameter 1 = %DiskID1%,,,""

How do I pass it the parameter for DiskID1 or do I need to?

Here is the .INF file.

--------------------------------------------------------------------
; Version section
[Version]
Signature="$Windows NT$"
Provider=HP
layoutfile=HP201Ip5.inf
ClassGUID={4D36E979-E325-11CE-BFC1-08002BE10318}
Class=Printer
catalogfile=HP201Ip5.cat
driverver=03/01/2002,4.3.2.201


; Manufacturer section
[Manufacturer]
HP=HPLaserPrinter

; Model sections.
[HPLaserPrinter]
%Printer%=HPBF201I.PMD,lptenumhewlett-packardhp_la848d

; Installer Sections
[HPBF201I.PMD]
DataSection=HPBF201I_DATA
CopyFiles=HPBF201I_FILES,LANGMON_FILES
DataFile=HPBF201I.PMD

; Data Sections
[HPBF201I_DATA]
DriverFile=HPBF201G.DLL
ConfigFile=HPBF201E.DLL
HelpFile=HPBF201I.HLP
LanguageMonitor=%HP_LANG_MONITOR%

; Copy Sections
[HPBF201I_FILES]
HPBF201E.DLL
HPBF201F.DLL
HPBF201G.DLL
HPBF201H.DLL
HPBF201I.PMD
HPBF201I.DLL
HPBF201I.HLP
HPBF201J.DLL
HPBF201K.DLL
HPBAFD32.DLL
HPBFTM32.DLL

[LANGMON_FILES]
HPDCMON.DLL

[DestinationDirs]
HPBF201I_FILES=66000
LANGMON_FILES=66000
DefaultDestDir=66000

; Localizable Strings
[Strings]
Printer="HP LaserJet 1100"
DiskID1="HP LaserJet 1100 Printer Driver Disk"
HP_LANG_MONITOR="HP LaserJet 5 Language Monitor,HPDCMON.DLL"


; Sourcedisks section
[SourceDisksNames.x86]
1 = %DiskId1%,,,""

[SourceDisksFiles.x86]
HPBF201E.DLL=1
HPBF201F.DLL=1
HPBF201G.DLL=1
HPBF201H.DLL=1
HPBF201I.PMD=1
HPBF201I.DLL=1
HPBF201I.HLP=1
HPBF201J.DLL=1
HPBF201K.DLL=1
HPDCMON.DLL=1
HPBAFD32.DLL=1
HPBFTM32.DLL=1
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Fri May 06, 2005 9:30 am    Post subject: Re: Installing printer drivers from within an application us Reply with quote


"Terry" <unknown (AT) unknown (DOT) com> wrote


Quote:
ShellExecute(NULL, "Install", "d:\test\hp201ip5.inf", NULL, NULL,
SW_SHOWNORMAL);

Use "install", not "Install". Notice the lowercase "i". Also, try passing
"d:\test" as the lpDirectory parameter.

Also, what is the actual return value of ShellExecute()? If <= 32, then an
error is occuring.

Quote:
However, the INF file has a section called SourceDisksName.x86,
parameter 1 = %DiskID1%,,,""

How do I pass it the parameter for DiskID1 or do I need to?

No. "DiskID1" is merely a string variable that the .inf itself is
specifying in its "[Strings]" section, and has nothing to do with the actual
source directory to begin with. If you read up on INF documentation, you
will find that the particular placement of %DiskID1% in the
"[SourceDiskNames.x86]" section is merely a display string that is shown if
a "file not found" dialog is shown to the user.

The way your .inf file is set up, all of the source files are in the same
folder as the .inf itself.


Gambit



Back to top
Terry
Guest





PostPosted: Fri May 06, 2005 1:16 pm    Post subject: Re: Installing printer drivers from within an application us Reply with quote

The return code indicates that it worked, however, shouldn't the files
have been copied to somewhere in the Windows directory?

Terry
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Fri May 06, 2005 5:44 pm    Post subject: Re: Installing printer drivers from within an application us Reply with quote


"Terry" <unknown (AT) unknown (DOT) com> wrote


Quote:
The return code indicates that it worked, however, shouldn't
the files have been copied to somewhere in the Windows directory?

The inf file is specifying Directory ID 66000 to indicate where the files
are to be copied to. ID 66000 cooresponds to the folder that is returned by
the GetPrinterDriverDirectory() function.


Gambit



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Native API) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.