Solved

VB6 HTML OCX - other than using Internet Explorer?

Posted on 2010-11-30
9
456 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

680 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