Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Create IE ActiveX Control with Windows Control Library project

Posted on 2007-03-19
12
301 Views
Last Modified: 2008-02-01
I would like to create an Internet Explorer ActiveX control using a Windows Control Library project that will allow me to print without a dialog box. Can someone tell me if this is possible? I created a control with limited functionality but haven't gotten it to print yet. Thanks.
0
Comment
Question by:rbichon
  • 7
  • 5
12 Comments
 
LVL 23

Expert Comment

by:Christopher Kile
ID: 18750270
This functionality undoubtedly exists because the Print icon on the standard IE toolbar does just that, prints without a dialogue.  Have you considered trying to simply hijack that functionality?
0
 
LVL 1

Author Comment

by:rbichon
ID: 18751305
The general concensous on the web is that there is no quick way to print without the dialog. Otherwise anyone would be able to simply print to any machine that you have setup on your computer.

I am not looking to simply print without a dialog box. I want to be able to configure which printer and orientation in the control.
0
 
LVL 23

Expert Comment

by:Christopher Kile
ID: 18751440
To do that, you have to have a guarantee as to how the client is configured, and I mean every POSSIBLE client.  Either that, or you can use the Print Dialog from the Common Controls library, and make sure that that gets installed as part of your ActiveX control plug-in.
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 1

Author Comment

by:rbichon
ID: 18755421
Is there an example online that I can use? I created an activex control and got the print dialog to popup but it doesn't print when I click print. Does it have to be a signed control?

The only clients using this control will be behind my network so configuration won't be a problem. Thanks for your help so far.
0
 
LVL 23

Accepted Solution

by:
Christopher Kile earned 500 total points
ID: 18755704
Were you able to select the printer you wanted to use?  Also, did anything appear in the print queues that did not later get printed?

Signing with a certain level would guarantee it, but lowering the security for objectsw loaded in the Intranet zone (or moving the residence of the control to a Trusted Site within your intranet) have worked just as well for me in the past (think of that as an anecdote, NOT as a guarantee :) ).  

Let me know as you progress (or if you cannot) and I'll advise where necessary.
0
 
LVL 1

Author Comment

by:rbichon
ID: 18757418
Okay. Now it tries to print but I get a .Net security error. It tells me that I can use the .Net Configuration Tool which I found under Administrative tools but don't know what to do next. Can you assist? Thanks.
0
 
LVL 1

Author Comment

by:rbichon
ID: 18757526
Nevermind. I got it figured out. I have it give Full Trust to my trusted internet sites. The question now is how do I get it to print the actual page. The page I am getting now is blank. I want it to print the full IE page. Any suggestions?
0
 
LVL 23

Expert Comment

by:Christopher Kile
ID: 18758243
You may want to create a test Windows application using the ActiveX control just to see if you can print a page from there.  That would isolate whether the control is having a problem, or the control works but it's not getting the data from IE.
0
 
LVL 1

Author Comment

by:rbichon
ID: 18758385
That is actually what I am doing but the page is blank. Is there a way to print the window?
0
 
LVL 1

Author Comment

by:rbichon
ID: 18759950
Okay, I got it to print the image I need (a barcode) and to the correct printer. Now I need to figure out how to pass the activex object a parameter. In PHP I would simply use a get variable in the URL. How would I send a parameter to this object?
0
 
LVL 1

Author Comment

by:rbichon
ID: 18763782
Got it all figured out now. First I added the site where the control exists to my Trusted Sites in Internet Explorer. Then using the .NET Configuration tool, I give Trusted Websites full control. And to pass a parameter to the ActiveX control, I set <PARAM NAME="RID" VALUE="10"> and in .NET I setup a property like this:

    Public myRID As String

    Public Property RID() As String
        Get
            Return myRID
        End Get
        Set(ByVal value As String)
            myRID = value
        End Set
    End Property
The variable "myRID" contains the value from the param with name "RID". Passing other parameters allows me to setup the printer I want to use with all of the settings and print immediately. Of course, you have to go through the Trust process otherwise the control will throw an error. Thanks for all of your help.
0
 
LVL 23

Expert Comment

by:Christopher Kile
ID: 18764153
yvw :)
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question