Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Incorrect printing of .mhtml file under Windows 7

Status
Not open for further replies.

ChrisRChamberlain

Programmer
Mar 23, 2000
3,392
GB
Hi all

Have an app, completely recompiled in Windows 7, that programatically creates and prints a .mhtml file through a printer attached to another networked pc.

No problems with the same app under Win XP but regardless of whether 'Print background colors and images' printing is checked or not, there is an image in the .mhtml that only prints the placeholder under Windows 7.

Open the .mhtml file in IE 8, and regardless of whether 'Print background colors and images' printing is checked or not, the image shows and prints correctly.

So, any ideas as to where the problem might lie?

TIA

FAQ184-2483​
Chris [pc2]
PDFcommander.com
motrac.co.uk
 
Hi Mike

Thanks for your reply.

The .mhtml file is being printed by an IE object, typical code being
Code:
WITH oMainObject.oIE
[tab].Navigate(lcMHTMLFile)

[tab]DO WHILE .Busy ;
[tab][tab][tab]OR .ReadyState # 4
[tab][tab]DOEVENTS
[tab]ENDDO

[tab].ExecWB(6,2,0,0)
ENDWITH
If execution is halted by MESSAGEBOX() immediately before the print command and the IE object made visible, the .jpg, background image, shows as expected.

Print it through the IE browser, it prints correctly, continue and print it through the IE object, .jpg does not print.

I've changed from one Windows 7 pc to another to ensure there was nothing peculiar with the hardware but the results are the same.

Yet to try printing through Shellexecute() as I would like to resolve this issue without a rewrite of this particular function.

Any ideas welcome. [smile]

FAQ184-2483​
Chris [pc2]
PDFcommander.com
motrac.co.uk
 

Attempting to print through ShellExecute() produced another insight into the wonders of Windows 7.

Although the default program to open .mhtml and .mht files is Internet Explorer, if you have MS Word installed that appears as a second choice.

Guess what - there's no way a user can remove that second choice without third party utilities/registry hacks.

Worse still, using the "print" parameter in ShellExecute(), the file opens in MS Word as opposed to printing through what should be the default Internet Explorer! [dazed]

Workaround? Web Browser control on a VFP form, .navigate() to local file and .execwb() prints as expected. [smile]

FAQ184-2483​
Chris [pc2]
PDFcommander.com
motrac.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top