Will an ActiveX control serve this purpose?

S

Shawn

Hi.
I've never created an ActiveX control before, so I know little about what it
is capable of and what its limitations are. My problem is this: I have to
create a way to send multiple documents from the web server to a printer on
the user's network. The way it works today the user has to manually
download each document and send it to his printer, but now they want me to
create an automated process.
Will I be able to download documents to the user's temp catalogue with an
ActiveX control? If I can do that I can just send them to his default
printer using ShellExecute.

Need to know if this is possible before I start researching :)
If anyone can provide me with a good tutorial that would be great!

Thanks,
Shawn
 
B

bradley

An ActiveX control is basically a COM compenent, typically with GUI
elements, that can be hosted by a container, such as a Windows Form or web
page, and scripted. It is similar in concept to a Java applet, except that
there are no restrictions about accessing the client's resources and file
system. It is a full blown Win32 executable, but with the extention OCX. The
clients browser security settings will need to be configured to allow this.
I think that by default IT will allow, but displays a confirmation dialog
before downloading the control.

Below are some MSDN articles..

HOW TO: Host ActiveX Controls in a Web Form
http://support.microsoft.com/default.aspx?scid=kb;en-us;317392

PRB: Cannot Develop DHTML Applications, ActiveX Documents, and IIS
Applications in Visual Basic .NET
http://support.microsoft.com/default.aspx?scid=kb;en-us;311300

Visual Basic 6.0 is the best (most user friendly) tool for building ActiveX
controls. The client will need to have the VB6 runtime installed on their
PC, but Windows 2000/XP comes bundled with this.
http://msdn.microsoft.com/library/d...s/vbcon98/html/vbconcreatingolecomponents.asp

However, if it were me, I would first try to implement a solution that
involved building WSH scripts dynamically on the server and then have the
client click on an execute them. A few lines of VB Script is much more
simple to program and maintain than delving into ActiveX control building,
especially if you havn't built one before.

http://msdn.microsoft.com/scripting

You didn't say what type of documents you are wanting to print, so I'm
assuming MS Word or Adobe PDF. You can find example script on the web for
automating MS Word and perhaps Adobe using WSH.

http://www.vandyke.com/support/crt/scripts/run_word_vbs.txt

Just like ActiveX controls, the client's browser security settings will
probably need modfying to execute .vbs or .js scripts from the web.

If you get this working, then reply back to the group with details.
 
S

Shawn

Hi.
Just letting you know that I solved my problem with the use of a WSH.
Thanks for pointing me in the right direction bradley!

Option Explicit
'*
Const cVBS = "savefile.vbs"
Const cOUT = "C:\temp\"
Const cURL = "http://www.google.no/intl/no_no/images/"
Const cPAG = "logo.gif"
'*

Fetch cURL & cPAG,cOUT & cPAG
Print cOUT & cPAG

Function Fetch(xURL,xOUT)
On Error Resume Next
Err.Clear
Dim b
With CreateObject("Microsoft.XMLHTTP")
.Open "GET",xURL,False
.Send
b = .ResponseBody
If Err.Number <> 0 Or .Status <> 200 Then
MsgBox Err.Number & " " & .Status
Fetch = False
Exit Function
End If
End With
With CreateObject("ADODB.Stream")
.Type = 1
.Open
.Write b
.SaveToFile xOUT,2
End With
Fetch = Err.Number = 0
End Function


Function Print(xURL)
Dim objShell
set objShell = CreateObject("Shell.Application")
objShell.ShellExecute xURL, "", "", "print", 1
set objShell = nothing
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,772
Messages
2,569,591
Members
45,103
Latest member
VinaykumarnNevatia
Top