Printing web pages

KBlack
12-03-2001, 02:45 AM
I have a list of about 21726 ish URLS and a lot of surveys in a database which I need to print. I have an option of whether to print the web pages or not - if I say no there is no problem and the program runs fine however if I try and get the web pages to print my program crashes with the Dr Watson dialog box. So I can only assume the problem lies with printing the webpages. It never crashes in the same place though :( and I cant see a reason why it would. Has anyone got any ideas how I could print these. (I dont need to see the pages before they print!).

Ad1
12-03-2001, 02:53 AM
what are you using to print the pages IE/WebBrowser Control/DHTMLEdit ?
what code are you using to print the pages ?

KBlack
12-03-2001, 02:56 AM
I am using a webrowser control to print them

I dont know which bits of code to put up here becuase I dont know ehere the problem lies but the actual print command is

WebB.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER, Empty, Empty

Ad1
12-03-2001, 03:07 AM
there is not a problem with the code you have posted, at a guess if you are printing lots of pages then the problem may be that the page is not loaded fully and the webbrowser is still busy, try putting this code just before the above line
<pre><font color=blue>Do</font color=blue>
DoEvents
<font color=blue>Loop Until</font color=blue> Browser.Busy = <font color=blue>False</font color=blue></pre>

KBlack
12-03-2001, 03:11 AM
I have this is the section that hads over the print job

Do Until frmBrowse.WebB.ReadyState = READYSTATE_COMPLETE
DoEvents
Loop

frmBrowse.PrintMap


does this not do the same thing?

Ad1
12-03-2001, 03:18 AM
yep that should do the same thing,

can you debug your program and tell me where it crashes, otherwise I can only take guesses

KBlack
12-03-2001, 03:28 AM
The problem is that the program does not produce a run-time error but instead crashes vb. Is there a way I can still tell where/how this program occurred?

P.S. Thank-you for your speedy responses it is reall appreciated - K

Ad1
12-03-2001, 03:37 AM
are you subclassing in your program?

I can only suggest that you put several on error gotos in your program where you suspect the problem may be and call a message box to display the error number

KBlack
12-03-2001, 04:17 AM
That worked I have fixed the problem it was the section that monitors the print job. I took that section out and it works. All I need to do now is to find out how to pull the names of any print jobs that are in the printer window into vb (without crashing my program) - Any ideas where I can start to look ??

Ad1
12-03-2001, 04:27 AM
The EnumJobs API retrieves information about a specified set of print jobs for a specified printer.

there are details and an example of this in the API Guide (http://www.allapi.net)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum