J
James
how come i can't print to a network printer from inside my activex dll? i
load this dll in an asp page. the dll just loads a page into a webbrowser
control and then trys to print it. i can call my dll from a normal vb app
and it works fine. my guess is that when IIS loads the dll it is running as
SYSTEM. thats why i tried to use the Impersonate user code as well. i guess
system can't access my network resources like my printers. any one have any
ideas?
'here is my dll code:
Public Function SendPrintJob() As String
On Error GoTo ErrorSub
' navigate to a Web site for testing purposes.
frmPrintOrder.WebBrowser1.Navigate ("http://www.google.com")
Do While (frmPrintOrder.WebBrowser1.QueryStatusWB(OLECMDID_PRINT) And
OLECMDF_ENABLED) = 0
DoEvents
Loop
' print the contents of the Web Browser control.
Call frmPrintOrder.WebBrowser1.ExecWB(OLECMDID_PRINT,
OLECMDEXECOPT_DONTPROMPTUSER, 0, 0)
SendPrintJob = "NoErrors"
Exit Function
ErrorSub:
SendPrintJob = "Error #: " & Err.Number & " Desc: " & Err.Description
End Function
<%
'here is my asp code:
Option Explicit
Dim objLogon
dim objPrintOrder
Set objLogon = Server.CreateObject("LoginAdmin.ImpersonateUser")
objLogon.Logon "user", "password", "domain"
set objPrintOrder = server.CreateObject("jdpPrintOrder.clsPrintOrder")
Response.write objPrintOrder.SendPrintJob
set objPrintOrder = nothing
objLogon.Logoff
Set objLogon = Nothing
%>
load this dll in an asp page. the dll just loads a page into a webbrowser
control and then trys to print it. i can call my dll from a normal vb app
and it works fine. my guess is that when IIS loads the dll it is running as
SYSTEM. thats why i tried to use the Impersonate user code as well. i guess
system can't access my network resources like my printers. any one have any
ideas?
'here is my dll code:
Public Function SendPrintJob() As String
On Error GoTo ErrorSub
' navigate to a Web site for testing purposes.
frmPrintOrder.WebBrowser1.Navigate ("http://www.google.com")
Do While (frmPrintOrder.WebBrowser1.QueryStatusWB(OLECMDID_PRINT) And
OLECMDF_ENABLED) = 0
DoEvents
Loop
' print the contents of the Web Browser control.
Call frmPrintOrder.WebBrowser1.ExecWB(OLECMDID_PRINT,
OLECMDEXECOPT_DONTPROMPTUSER, 0, 0)
SendPrintJob = "NoErrors"
Exit Function
ErrorSub:
SendPrintJob = "Error #: " & Err.Number & " Desc: " & Err.Description
End Function
<%
'here is my asp code:
Option Explicit
Dim objLogon
dim objPrintOrder
Set objLogon = Server.CreateObject("LoginAdmin.ImpersonateUser")
objLogon.Logon "user", "password", "domain"
set objPrintOrder = server.CreateObject("jdpPrintOrder.clsPrintOrder")
Response.write objPrintOrder.SendPrintJob
set objPrintOrder = nothing
objLogon.Logoff
Set objLogon = Nothing
%>