Solved

Create IE ActiveX Control with Windows Control Library project

Posted on 2007-03-19
12
302 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
[X]
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
  • 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
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

Suggested Solutions

Title # Comments Views Activity
Footer for each row on Gridview 2 41
"lblTime is not declared" 3 35
Stop Git from being my repository 1 25
reading an excel file vb.net 2 20
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…
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

733 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