Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help need on using ShellExecute to print files

Status
Not open for further replies.

philipmatic

Programmer
May 18, 2003
17
JP
Hi everyone, I am new to this group...

But what I need is help on my ShellExecute function. That is, I have generated an ASP file to send a single or batch file to a local directory (which works fine) and to the printer to be printed (which doesn't work at all).

here is a snippet of the ASP code (sending the file to the dll file used to execute the printer process):

set objFS = CreateObject("InternetExplorer.Application")
Set objWSHNet = CreateObject("WScript.Network")
set oPrint = CreateObject("antman.printHTML")
set objque = getobject("WinNT://ibase/IBGPROD/HPLaser2100")

' Connect to Network Printer from Windows Script Host
On Error Resume Next
objWSHNet.RemovePrinterConnection "LPT1:"
objWSHNet.AddPrinterConnection "LPT1", "\\IBGPROD\HPLaser2100", False
response.write oPrint.printMe(filepath & filename, vbnullstring)

Then it points to the dll file which reads as follows:

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Public Function printMe(ByVal filename As String, ByVal filepath As String) As String

Dim myResult As Long

On Error GoTo failed

'print HTML
myResult = ShellExecute(0, "Print", filename, vbNullString, filepath, SW_HIDE)

Exit Function

failed:
printMe = "FALSE - " & CStr(myResult)
End Function

The part that isn't working relates to the PrintMe(), especially the myresult function...

Can anyone please provide me with assistance to my dilemma...

?;-p
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top