Click here to Skip to main content
15,891,704 members
Home / Discussions / C#
   

C#

 
GeneralMD5 HashCode Pin
pahluwalia3-Oct-03 8:07
pahluwalia3-Oct-03 8:07 
GeneralRe: MD5 HashCode Pin
Daniel M. Edwards3-Oct-03 9:50
Daniel M. Edwards3-Oct-03 9:50 
QuestionEvents not firing from collections? Pin
FruitBatInShades3-Oct-03 4:26
FruitBatInShades3-Oct-03 4:26 
GeneralByte Arrays Pin
MrEyes3-Oct-03 0:49
MrEyes3-Oct-03 0:49 
GeneralRe: Byte Arrays Pin
Mattias Olgerfelt3-Oct-03 1:04
Mattias Olgerfelt3-Oct-03 1:04 
GeneralRe: Byte Arrays Pin
MrEyes3-Oct-03 2:24
MrEyes3-Oct-03 2:24 
GeneralRe: Byte Arrays Pin
Daniel Turini3-Oct-03 5:45
Daniel Turini3-Oct-03 5:45 
GeneralAxBrowser/mshtml annoyances Pin
mephist2-Oct-03 16:07
mephist2-Oct-03 16:07 
I have been pulling my hair out trying to get AxBrowser and mshtml components to work properly, if anyone can help me out, it would be much appreciated...

First of all, what I am trying to achieve is basically to get AxBrowser to print properly using:

AxWebBrowser.ExecWB( SHDocVw.OLECMDID.OLECMDID_PRINT, SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_PROMPTUSER, ref obj, ref obj );

where obj = null.

I have two AxBrowsers running at the same time, one that is hidden from the user's view (but not set to Visible=false since this causes an exception to be thrown everytime you try to print). I dynamically generate html which is then saved to file via the use of the StreamWriter class, then I call AxBrowser.Navigate(...) [for the AxBrowser that the user can actually see] to the new file.

If they want to print it out, they can (without problems using the above mentioned line of code). However, these things that I am generating for the user to see are created from an XML document that is run through XSL. Long story short, the XML file contains different items that get transformed in html, and the user is allowed to print ALL the items that are available on the XML document. Now, to do this, I generate all documents in the background and display it on the other AxBrowser (the one which the user cannot see so that the AxBrowser that they CAN see doesnt flicker and change documents in front of them), then tell it to print.

The problem is, after I save the html to file, tell the browser to navigate to it, then call the ExecWB print command, it seems to print out it's HTMLDocument's previous html content.

For example, the "hidden" AxBrowser is first initialized and navigated to "about:blank". The user clicks on Print All, so my code generates the html, saves it, tells the "hidden" AxBrowser to navigate there, then calls the ExecWB print command. Instead, what it DOES print out is a blank page! Then if the user tries to Print All again (but selecting a different display format), AxBrowser prints out the PREviously generated document.

Is there any explanation for this behaviour??

Also, there is the issue with AxBrowser always printing out the default headers and footers. There doesn't seem to be an easy way of setting the header/footer text WITHout modifying the registry. Microsoft has an article on how to do it via the ExecWB command, however it is in C++ at:
http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q267/2/40.ASP&NoWebContent=1[^]

I am very unfamiliar with C++ and just need a way to do what that code suggests, but in C#. Does someone have another way of doing this? I know that you can prompt the user to edit the page settings, but thats not what I want to do. The only prompting I want done is for the user to select the printer that they wish to print to.

Thanks for any help!



- mephist
GeneralCreating a virtual drive Pin
jij@esenet.dk2-Oct-03 10:32
jij@esenet.dk2-Oct-03 10:32 
GeneralRe: Creating a virtual drive Pin
Blake Coverett2-Oct-03 20:18
Blake Coverett2-Oct-03 20:18 
GeneralRe: Creating a virtual drive Pin
James Simpson6-Oct-03 1:01
James Simpson6-Oct-03 1:01 
GeneralRe: Creating a virtual drive Pin
jij@esenet.dk7-Oct-03 7:04
jij@esenet.dk7-Oct-03 7:04 
GeneralRe: Creating a virtual drive Pin
jij@esenet.dk7-Oct-03 7:05
jij@esenet.dk7-Oct-03 7:05 
GeneralString question Pin
Mike Ellison2-Oct-03 10:24
Mike Ellison2-Oct-03 10:24 
GeneralRe: String question Pin
Loki2-Oct-03 10:38
Loki2-Oct-03 10:38 
GeneralRe: String question Pin
Nathan Blomquist2-Oct-03 10:41
Nathan Blomquist2-Oct-03 10:41 
GeneralRe: String question Pin
Nathan Blomquist2-Oct-03 10:40
Nathan Blomquist2-Oct-03 10:40 
GeneralRe: String question Pin
Daniel Turini2-Oct-03 11:08
Daniel Turini2-Oct-03 11:08 
GeneralRe: String question Pin
Mike Ellison2-Oct-03 11:11
Mike Ellison2-Oct-03 11:11 
GeneralRe: String question Pin
Nick Parker2-Oct-03 13:14
protectorNick Parker2-Oct-03 13:14 
GeneralRe: String question Pin
Mike Ellison2-Oct-03 13:32
Mike Ellison2-Oct-03 13:32 
GeneralCrystal Report Types Difference Pin
Inam2-Oct-03 9:19
Inam2-Oct-03 9:19 
Generalconst v readonly Pin
pseudonym672-Oct-03 9:19
pseudonym672-Oct-03 9:19 
GeneralRe: const v readonly Pin
Blake Coverett2-Oct-03 10:18
Blake Coverett2-Oct-03 10:18 
GeneralRe: const v readonly Pin
pseudonym672-Oct-03 12:05
pseudonym672-Oct-03 12:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.