Solved

VB6 HTML OCX - other than using Internet Explorer?

Posted on 2010-11-30
9
454 Views
Last Modified: 2012-05-10
I'm looking for a library that will render an HTML page and allow it to be printed.

Functionality to be like using IE via the VB6 Web browser control, but NOT using IE.

I'm having issues trying to properly trap errors generated from IE, so need something that is running in-process and without the IE overhead.

User display is not needed.


Does anyone know of such a control?



Thanks.
0
Comment
Question by:StuckInTheMud
  • 5
  • 4
9 Comments
 
LVL 45

Expert Comment

by:aikimark
ID: 34251148
what about the WinInet control?

What compatibility level of rendering do you need?

Does the user need to see the rendered page or do you just need to print the page?

What are you trying to do by printing the page? (problem context)
0
 

Author Comment

by:StuckInTheMud
ID: 34251187
I'm creating a simple report (just paragraphs & tables and bit of in-line styling) in HTML and then just printing it.

Base HTML comes from a pre-prepared template, it's warehouse picking notes which should give you a good idea about the simplicity of layout!

No requirement to see the page.

So I need something that is going to interpret the HTML and render it correctly on a printed page.
0
 
LVL 45

Expert Comment

by:aikimark
ID: 34251424
Why don't you use the default browser to do the print?  I don't see any need to do any rendering in your VB6 application.

Your application could Shell() the necessary DOS command string to cause the HTML file to be printed.  There are two ways you might do this.

* use the default browser's file association (your command string will need to start with CMD.EXE
* find the path of the default browser in the registry and use that as the program you launch.
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:StuckInTheMud
ID: 34251665
Problem is trapping errors, e.g. if the print server isn't available and the print function hangs and eventually times out.

Running external processes (web browser control or shell) will just return "automation error" or similar, which is very difficult to sensibly trap and recover from, hence wanting to run it in-process.



Jim
0
 

Author Comment

by:StuckInTheMud
ID: 34251690
Additional info - I have been using the web browser control in the application for some while (year+) so looking to improve on what we have and give a better "user experience" when there are system problems.
0
 
LVL 45

Expert Comment

by:aikimark
ID: 34251993
Here are some options to consider.
* use a more intelligent print server that queues print jobs
* look at the print server event log entries for problems, taking action as necessary.  You should probably institute a process that notes which documents were to be printed and then reprint any documents that weren't printed.  This creates a feedback mechanism for your application.
* Introduce an intermediate process that might be more resilient.  For instance, you might do your application printing to PDF documents in a server directory.  Then you would have a separate process that would physically print and then delete-after-print the PDF files.
0
 

Author Comment

by:StuckInTheMud
ID: 34253355
Thanks, but we have already been round the loop on other options.

To answer you suggestions.

(1) It does queue (Windows server), just occasionally occasionally the server is off-line which is what we are trying to trap.

(2) Not feasible, as the print is on demand from a real-time ordering system in a call centre.

(3) As 2, it's an on-demand system so printing to PDF and then queuing introduces an unacceptable time delay.


I guess from the replies that using an out-of-process browser is really the only way of printing an HTML document and a library to do the job doesn't exist.
0
 
LVL 45

Accepted Solution

by:
aikimark earned 125 total points
ID: 34253423
If you are trying to trap the print server not ready condition, you might try to write a 'header page' (only has to be a single line) with your VB6 code.
0
 

Author Closing Comment

by:StuckInTheMud
ID: 34368040
Not exactly what I was looking for, but suggestions have been useful
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

840 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