Solved

VB6 HTML OCX - other than using Internet Explorer?

Posted on 2010-11-30
9
449 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
 

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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…

760 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now