|
-
May 14th, 2000, 05:53 PM
#1
Thread Starter
New Member
Hi Guys,
I am new to VB and I have a question for you guys. I would appreciate if some one can help me to resolve that peoblem. I am trying print a file from a programme by clicking a button. I don't want to open that file, and I just want to print it to a printer. I wrote a programme using shellexecute and it is working alright but it is bringing up the printer dialog box to select a printer. Is there any way of avoiding that printer dialog box by choosing a printer as a constant or what ever?
my programme is as follows (it has one form and a module):
------Module-------------
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
-------------------------
----------Form-------------
Private Sub Command1_Click()
Dim r As Long
Dim lRtn As Long
Dim Action As String
Dim fname As String
'Printer.DeviceName = "lj_cs"
fname = "c:\temp\readme.html"
Action = "print"
'FileExecutor Me.hWnd, fname, Action
r = ShellExecute(Me.hWnd, Action, fname, vbNullChar, vbNullChar, 0)
End Sub
Private Sub Form_Load()
End Sub
-------------------------------------
You may ask why do I need this?? I am trying to create a dll and want to use it in an ASP page.
I would appreciate your help.
Thanks in advance for your kind help.
Alex
-
May 14th, 2000, 11:10 PM
#2
One thing you can do is to insert this line following your ShellExecute
SendKeys "{ENTER}"
-
May 15th, 2000, 04:42 AM
#3
Thread Starter
New Member
THanks martin,
I tried sendkeys method but it is still bringing up the printer dialog box to select printer. I dunno how to solve this problem. Is there any other way of printing a HTML file without user interaction? I tried very basic command: shell(lpr -S server -P printer filename) but it is only for printing a text file. What I want to do is print a html file or ASP file. (note: if I use the same lpr command for a html file then I will only get a print out of html code not an actual view of html)
Thanks
Alex
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|