473,732 Members | 2,204 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

iHTMLElementren der.drawtodc causes error in VB.net application

ddd
Hi,

I am having problems with using the DrawToDC of the
MSHTML.iHTMLEle mentRender in a VB.net application. For some reason I am
getting a "catastroph ic error". I am basing the code on c# examples, and I
am not sure what exactly I am doing wrong. From the C# posts it seems that
the drawtodc has a bug and you need to redifine it, so i followed their
advice and specified an interface as below:
Imports System
Imports System.Drawing
Imports System.Runtime. InteropServices
Imports mshtml

<ComVisible(Tru e), ComImport(),
Guid("3050f669-98b5-11cf-bb82-00aa00bdce0b"), _
InterfaceTypeAt tribute(ComInte rfaceType.Inter faceIsIUnknown) > _
Interface IHTMLElementRen der
Sub DrawToDC(<[In]()> ByVal hDC As IntPtr)
Sub SetDocumentPrin ter(<[In](), MarshalAs(Unman agedType.BStr)> ByVal
bstrPrinterName As String, <[In]()> ByVal hDC As IntPtr)
End Interface 'IHTMLElementRe nder

On the main form of the application I am doing the following:

Dim objMSHTML As HTMLDocument
Dim objDocument As IHTMLDocument2
Dim ips As IPersistStreamI nit

objMSHTML = New HTMLDocument()

ips = DirectCast(objM SHTML, IPersistStreamI nit)
ips.InitNew()

objDocument =
objMSHTML.creat eDocumentFromUr l("http://www.google.com" , String.Empty)

Do Until objDocument.rea dyState = "complete"
Application.DoE vents()
Loop

MsgBox(objDocum ent.body.outerH TML)
Dim bodyElement As IHTMLElement
Dim render As IHTMLElementRen der
If objDocument.bod y.outerHTML <> Nothing Then
bodyElement = objDocument.bod y
render = bodyElement
Dim img As New Bitmap(600, 400)
Dim g As Graphics = Graphics.FromIm age(img)
Dim memDC As IntPtr
memDC = g.GetHdc()

Try
render.DrawToDC (memDC)
Catch ex As Exception
MsgBox(ex.ToStr ing)
End Try
End If

It seems like I am getting the HTML document just fine, is just that when I
try to use DrawToDC to get the application to print/send to the DC i Created
in memory, it causes the error.Any ideas on what I am doing wrong?

Here are the links to where I got the C# examples:
http://groups.google.com/groups?hl=e...C%2B%2Bfailure
http://blogs.msdn.com/rfarber/archiv...12/240943.aspx

thanks
Nov 16 '05 #1
5 5032
Are you sure the error occurs on DrawToDc? I would expect an invalid cast
error on the line
render = bodyElement
I also assume that you have Option Strict Off. Turning it on will ensure you
cast objects correctly.

It looks to me like you are caught between two stools. On the one hand you
want a light-weight program without the rendering part of the WebBrowser or
InternetExplore r controls (ShdocVw), and on the other you want to render
elements using the IHTMLElementRen der interface.

Unfortunately you can't use this interface unless you host mshtml properly,
and that includes the rendering part.

When you load the document below it is not rendered; just loaded into
memory. Therefore you cannot render it to a device context because there is
no rendered page to copy.

You can continue to manipulate the html as you have below, but if you want
to render it you must either use the WebBrowser/InternetExplore r controls or
host mshtml fully yourself.

HTH

Charles
"ddd" <so******@nowhe reforspam.com> wrote in message
news:uO******** ******@TK2MSFTN GP14.phx.gbl... Hi,

I am having problems with using the DrawToDC of the
MSHTML.iHTMLEle mentRender in a VB.net application. For some reason I am
getting a "catastroph ic error". I am basing the code on c# examples, and I
am not sure what exactly I am doing wrong. From the C# posts it seems that
the drawtodc has a bug and you need to redifine it, so i followed their
advice and specified an interface as below:
Imports System
Imports System.Drawing
Imports System.Runtime. InteropServices
Imports mshtml

<ComVisible(Tru e), ComImport(),
Guid("3050f669-98b5-11cf-bb82-00aa00bdce0b"), _
InterfaceTypeAt tribute(ComInte rfaceType.Inter faceIsIUnknown) > _
Interface IHTMLElementRen der
Sub DrawToDC(<[In]()> ByVal hDC As IntPtr)
Sub SetDocumentPrin ter(<[In](), MarshalAs(Unman agedType.BStr)> ByVal
bstrPrinterName As String, <[In]()> ByVal hDC As IntPtr)
End Interface 'IHTMLElementRe nder

On the main form of the application I am doing the following:

Dim objMSHTML As HTMLDocument
Dim objDocument As IHTMLDocument2
Dim ips As IPersistStreamI nit

objMSHTML = New HTMLDocument()

ips = DirectCast(objM SHTML, IPersistStreamI nit)
ips.InitNew()

objDocument =
objMSHTML.creat eDocumentFromUr l("http://www.google.com" , String.Empty)

Do Until objDocument.rea dyState = "complete"
Application.DoE vents()
Loop

MsgBox(objDocum ent.body.outerH TML)
Dim bodyElement As IHTMLElement
Dim render As IHTMLElementRen der
If objDocument.bod y.outerHTML <> Nothing Then
bodyElement = objDocument.bod y
render = bodyElement
Dim img As New Bitmap(600, 400)
Dim g As Graphics = Graphics.FromIm age(img)
Dim memDC As IntPtr
memDC = g.GetHdc()

Try
render.DrawToDC (memDC)
Catch ex As Exception
MsgBox(ex.ToStr ing)
End Try
End If

It seems like I am getting the HTML document just fine, is just that when
I
try to use DrawToDC to get the application to print/send to the DC i
Created
in memory, it causes the error.Any ideas on what I am doing wrong?

Here are the links to where I got the C# examples:
http://groups.google.com/groups?hl=e...C%2B%2Bfailure
http://blogs.msdn.com/rfarber/archiv...12/240943.aspx

thanks

Nov 16 '05 #2
ddd
Hi Charles,

First of all thanks for taking the time to reply to this post. I am
definetly not getting an error on the render=bodyelem ent and i do have
Option Explicit On and Option Strict On for the IHTMLElementRen der
interface class.

As about using the WebBrowser control. I am not sure how exactly to do this.
I added a reference to SHDocVw, but I still cannot figure out how to do this
properly. Do I just add the references, to I load the page through the
webbrowser object? I did look at the C# example and they declare an object
that as IHTMLDocument2 and than they set it to be the document of the
webbrowser, however, I got errors when I did this. I also was unclear if i
would need to load the URL through Navigate2 (of the webbrowser) or the
createDocumentF romUrl.

Can you point me to any documents/tutorial where they explain how to host
the MSHTML correctly?

thanks

tony

"Charles Law" <bl***@nowhere. com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Are you sure the error occurs on DrawToDc? I would expect an invalid cast
error on the line
render = bodyElement
I also assume that you have Option Strict Off. Turning it on will ensure

you cast objects correctly.

It looks to me like you are caught between two stools. On the one hand you
want a light-weight program without the rendering part of the WebBrowser or InternetExplore r controls (ShdocVw), and on the other you want to render
elements using the IHTMLElementRen der interface.

Unfortunately you can't use this interface unless you host mshtml properly, and that includes the rendering part.

When you load the document below it is not rendered; just loaded into
memory. Therefore you cannot render it to a device context because there is no rendered page to copy.

You can continue to manipulate the html as you have below, but if you want
to render it you must either use the WebBrowser/InternetExplore r controls or host mshtml fully yourself.

HTH

Charles
"ddd" <so******@nowhe reforspam.com> wrote in message
news:uO******** ******@TK2MSFTN GP14.phx.gbl...
Hi,

I am having problems with using the DrawToDC of the
MSHTML.iHTMLEle mentRender in a VB.net application. For some reason I am
getting a "catastroph ic error". I am basing the code on c# examples, and I am not sure what exactly I am doing wrong. From the C# posts it seems that the drawtodc has a bug and you need to redifine it, so i followed their
advice and specified an interface as below:
Imports System
Imports System.Drawing
Imports System.Runtime. InteropServices
Imports mshtml

<ComVisible(Tru e), ComImport(),
Guid("3050f669-98b5-11cf-bb82-00aa00bdce0b"), _
InterfaceTypeAt tribute(ComInte rfaceType.Inter faceIsIUnknown) > _
Interface IHTMLElementRen der
Sub DrawToDC(<[In]()> ByVal hDC As IntPtr)
Sub SetDocumentPrin ter(<[In](), MarshalAs(Unman agedType.BStr)> ByVal
bstrPrinterName As String, <[In]()> ByVal hDC As IntPtr)
End Interface 'IHTMLElementRe nder

On the main form of the application I am doing the following:

Dim objMSHTML As HTMLDocument
Dim objDocument As IHTMLDocument2
Dim ips As IPersistStreamI nit

objMSHTML = New HTMLDocument()

ips = DirectCast(objM SHTML, IPersistStreamI nit)
ips.InitNew()

objDocument =
objMSHTML.creat eDocumentFromUr l("http://www.google.com" , String.Empty)

Do Until objDocument.rea dyState = "complete"
Application.DoE vents()
Loop

MsgBox(objDocum ent.body.outerH TML)
Dim bodyElement As IHTMLElement
Dim render As IHTMLElementRen der
If objDocument.bod y.outerHTML <> Nothing Then
bodyElement = objDocument.bod y
render = bodyElement
Dim img As New Bitmap(600, 400)
Dim g As Graphics = Graphics.FromIm age(img)
Dim memDC As IntPtr
memDC = g.GetHdc()

Try
render.DrawToDC (memDC)
Catch ex As Exception
MsgBox(ex.ToStr ing)
End Try
End If

It seems like I am getting the HTML document just fine, is just that when I
try to use DrawToDC to get the application to print/send to the DC i
Created
in memory, it causes the error.Any ideas on what I am doing wrong?

Here are the links to where I got the C# examples:
http://groups.google.com/groups?hl=e...C%2B%2Bfailure http://blogs.msdn.com/rfarber/archiv...12/240943.aspx

thanks


Nov 16 '05 #3
ddd
I tried the following code which use the internetexplore r to load the page
and than use MSHTML, but this time I got a cast error at the
render=Bodyelem ent, didn't even make it to the DrawToDc.

Dim browser As New SHDocVw.Interne tExplorer()

browser.Navigat e("http://www.google.com" )

Do Until browser.ReadySt ate = 4
Application.DoE vents()
Loop
Dim objDocument As IHTMLDocument2 = browser.Documen t

MsgBox(objDocum ent.body.outerH TML)

Dim bodyElement As IHTMLElement = objDocument.bod y

Dim render As IHTMLElementRen der = bodyElement
Dim img As New Bitmap(600, 400)
Dim g As Graphics = Graphics.FromIm age(img)
Dim memDC As IntPtr
memDC = g.GetHdc()

Try
render.DrawToDC (memDC)
Catch ex As Exception
MsgBox(ex.ToStr ing)
End Try

I also tried to use the webbrowser and iWebBrowser2 like in the c# examples
but no luck in getting them work either. for some reason Navigate/Navigate2
were throwing uknown errors (i think because the control was not in the
form).

Any suggestions?
thanks

tony
"Charles Law" <bl***@nowhere. com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Are you sure the error occurs on DrawToDc? I would expect an invalid cast
error on the line
render = bodyElement
I also assume that you have Option Strict Off. Turning it on will ensure

you cast objects correctly.

It looks to me like you are caught between two stools. On the one hand you
want a light-weight program without the rendering part of the WebBrowser or InternetExplore r controls (ShdocVw), and on the other you want to render
elements using the IHTMLElementRen der interface.

Unfortunately you can't use this interface unless you host mshtml properly, and that includes the rendering part.

When you load the document below it is not rendered; just loaded into
memory. Therefore you cannot render it to a device context because there is no rendered page to copy.

You can continue to manipulate the html as you have below, but if you want
to render it you must either use the WebBrowser/InternetExplore r controls or host mshtml fully yourself.

HTH

Charles
"ddd" <so******@nowhe reforspam.com> wrote in message
news:uO******** ******@TK2MSFTN GP14.phx.gbl...
Hi,

I am having problems with using the DrawToDC of the
MSHTML.iHTMLEle mentRender in a VB.net application. For some reason I am
getting a "catastroph ic error". I am basing the code on c# examples, and I am not sure what exactly I am doing wrong. From the C# posts it seems that the drawtodc has a bug and you need to redifine it, so i followed their
advice and specified an interface as below:
Imports System
Imports System.Drawing
Imports System.Runtime. InteropServices
Imports mshtml

<ComVisible(Tru e), ComImport(),
Guid("3050f669-98b5-11cf-bb82-00aa00bdce0b"), _
InterfaceTypeAt tribute(ComInte rfaceType.Inter faceIsIUnknown) > _
Interface IHTMLElementRen der
Sub DrawToDC(<[In]()> ByVal hDC As IntPtr)
Sub SetDocumentPrin ter(<[In](), MarshalAs(Unman agedType.BStr)> ByVal
bstrPrinterName As String, <[In]()> ByVal hDC As IntPtr)
End Interface 'IHTMLElementRe nder

On the main form of the application I am doing the following:

Dim objMSHTML As HTMLDocument
Dim objDocument As IHTMLDocument2
Dim ips As IPersistStreamI nit

objMSHTML = New HTMLDocument()

ips = DirectCast(objM SHTML, IPersistStreamI nit)
ips.InitNew()

objDocument =
objMSHTML.creat eDocumentFromUr l("http://www.google.com" , String.Empty)

Do Until objDocument.rea dyState = "complete"
Application.DoE vents()
Loop

MsgBox(objDocum ent.body.outerH TML)
Dim bodyElement As IHTMLElement
Dim render As IHTMLElementRen der
If objDocument.bod y.outerHTML <> Nothing Then
bodyElement = objDocument.bod y
render = bodyElement
Dim img As New Bitmap(600, 400)
Dim g As Graphics = Graphics.FromIm age(img)
Dim memDC As IntPtr
memDC = g.GetHdc()

Try
render.DrawToDC (memDC)
Catch ex As Exception
MsgBox(ex.ToStr ing)
End Try
End If

It seems like I am getting the HTML document just fine, is just that when I
try to use DrawToDC to get the application to print/send to the DC i
Created
in memory, it causes the error.Any ideas on what I am doing wrong?

Here are the links to where I got the C# examples:
http://groups.google.com/groups?hl=e...C%2B%2Bfailure http://blogs.msdn.com/rfarber/archiv...12/240943.aspx

thanks


Nov 16 '05 #4
The easiest way in VB.NET is still to add a WebBrowser control to a form.
When I select Customize Toolbox, it shows up on the COM Components tab as
Microsoft Web Browser.

When you do this the WebBrowser control will be wrapped (it is an ActiveX)
and called AxWebBrowser1, indicating that it is wrapped in an AxHost. This
is to marshal calls backwards and forwards between managed and unmanaged
code.

The AxWebBrowser1 object will have a document property, which supports the
IHTMLDocument2 interface, amongst others.

If you do this you should find that you can cast bodyElement to render, as
in

render = DirectCast(body Element, mshtml.IHTMLEle mentRender)

Just a note on the Option Strict thing: when you say that you have it on, do
you mean that you have a statement

Option Strict On

at the start of the module containing the code? If so, I would expect a
compile error on the line

render = bodyElement

because they are not the same types.

HTH

Charles
"ddd" <so******@nowhe reforspam.com> wrote in message
news:%2******** **********@TK2M SFTNGP11.phx.gb l...
Hi Charles,

First of all thanks for taking the time to reply to this post. I am
definetly not getting an error on the render=bodyelem ent and i do have
Option Explicit On and Option Strict On for the IHTMLElementRen der
interface class.

As about using the WebBrowser control. I am not sure how exactly to do
this.
I added a reference to SHDocVw, but I still cannot figure out how to do
this
properly. Do I just add the references, to I load the page through the
webbrowser object? I did look at the C# example and they declare an object
that as IHTMLDocument2 and than they set it to be the document of the
webbrowser, however, I got errors when I did this. I also was unclear if i
would need to load the URL through Navigate2 (of the webbrowser) or the
createDocumentF romUrl.

Can you point me to any documents/tutorial where they explain how to host
the MSHTML correctly?

thanks

tony

"Charles Law" <bl***@nowhere. com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Are you sure the error occurs on DrawToDc? I would expect an invalid cast
error on the line
> render = bodyElement


I also assume that you have Option Strict Off. Turning it on will ensure

you
cast objects correctly.

It looks to me like you are caught between two stools. On the one hand
you
want a light-weight program without the rendering part of the WebBrowser

or
InternetExplore r controls (ShdocVw), and on the other you want to render
elements using the IHTMLElementRen der interface.

Unfortunately you can't use this interface unless you host mshtml

properly,
and that includes the rendering part.

When you load the document below it is not rendered; just loaded into
memory. Therefore you cannot render it to a device context because there

is
no rendered page to copy.

You can continue to manipulate the html as you have below, but if you
want
to render it you must either use the WebBrowser/InternetExplore r controls

or
host mshtml fully yourself.

HTH

Charles
"ddd" <so******@nowhe reforspam.com> wrote in message
news:uO******** ******@TK2MSFTN GP14.phx.gbl...
> Hi,
>
> I am having problems with using the DrawToDC of the
> MSHTML.iHTMLEle mentRender in a VB.net application. For some reason I am
> getting a "catastroph ic error". I am basing the code on c# examples,
> and I > am not sure what exactly I am doing wrong. From the C# posts it seems that > the drawtodc has a bug and you need to redifine it, so i followed their
> advice and specified an interface as below:
>
>
> Imports System
> Imports System.Drawing
> Imports System.Runtime. InteropServices
> Imports mshtml
>
> <ComVisible(Tru e), ComImport(),
> Guid("3050f669-98b5-11cf-bb82-00aa00bdce0b"), _
> InterfaceTypeAt tribute(ComInte rfaceType.Inter faceIsIUnknown) > _
> Interface IHTMLElementRen der
> Sub DrawToDC(<[In]()> ByVal hDC As IntPtr)
> Sub SetDocumentPrin ter(<[In](), MarshalAs(Unman agedType.BStr)> ByVal
> bstrPrinterName As String, <[In]()> ByVal hDC As IntPtr)
> End Interface 'IHTMLElementRe nder
>
> On the main form of the application I am doing the following:
>
> Dim objMSHTML As HTMLDocument
> Dim objDocument As IHTMLDocument2
> Dim ips As IPersistStreamI nit
>
> objMSHTML = New HTMLDocument()
>
> ips = DirectCast(objM SHTML, IPersistStreamI nit)
> ips.InitNew()
>
> objDocument =
> objMSHTML.creat eDocumentFromUr l("http://www.google.com" , String.Empty)
>
> Do Until objDocument.rea dyState = "complete"
> Application.DoE vents()
> Loop
>
> MsgBox(objDocum ent.body.outerH TML)
> Dim bodyElement As IHTMLElement
> Dim render As IHTMLElementRen der
>
>
> If objDocument.bod y.outerHTML <> Nothing Then
> bodyElement = objDocument.bod y
> render = bodyElement
> Dim img As New Bitmap(600, 400)
> Dim g As Graphics = Graphics.FromIm age(img)
> Dim memDC As IntPtr
> memDC = g.GetHdc()
>
> Try
> render.DrawToDC (memDC)
> Catch ex As Exception
> MsgBox(ex.ToStr ing)
> End Try
>
>
> End If
>
> It seems like I am getting the HTML document just fine, is just that when > I
> try to use DrawToDC to get the application to print/send to the DC i
> Created
> in memory, it causes the error.Any ideas on what I am doing wrong?
>
> Here are the links to where I got the C# examples:
> http://groups.google.com/groups?hl=e...C%2B%2Bfailure > http://blogs.msdn.com/rfarber/archiv...12/240943.aspx
>
> thanks
>
>



Nov 16 '05 #5
You are right about the unknown errors (unspecified error, I think). This
is, as you surmise, because mshtml is not hosted properly. As per my other
reply, the easiest way to is to put a WebBrowser control on the form. I
wouldn't recommend going the other route (hosting it manually) as all you
will end up doing is recreating the code already in the WebBrowser control,
and it is not for the faint-hearted.

Charles
"ddd" <so******@nowhe reforspam.com> wrote in message
news:u4******** ******@TK2MSFTN GP12.phx.gbl...
I tried the following code which use the internetexplore r to load the page
and than use MSHTML, but this time I got a cast error at the
render=Bodyelem ent, didn't even make it to the DrawToDc.

Dim browser As New SHDocVw.Interne tExplorer()

browser.Navigat e("http://www.google.com" )

Do Until browser.ReadySt ate = 4
Application.DoE vents()
Loop
Dim objDocument As IHTMLDocument2 = browser.Documen t

MsgBox(objDocum ent.body.outerH TML)

Dim bodyElement As IHTMLElement = objDocument.bod y

Dim render As IHTMLElementRen der = bodyElement
Dim img As New Bitmap(600, 400)
Dim g As Graphics = Graphics.FromIm age(img)
Dim memDC As IntPtr
memDC = g.GetHdc()

Try
render.DrawToDC (memDC)
Catch ex As Exception
MsgBox(ex.ToStr ing)
End Try

I also tried to use the webbrowser and iWebBrowser2 like in the c#
examples
but no luck in getting them work either. for some reason
Navigate/Navigate2
were throwing uknown errors (i think because the control was not in the
form).

Any suggestions?
thanks

tony
"Charles Law" <bl***@nowhere. com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Are you sure the error occurs on DrawToDc? I would expect an invalid cast
error on the line
> render = bodyElement


I also assume that you have Option Strict Off. Turning it on will ensure

you
cast objects correctly.

It looks to me like you are caught between two stools. On the one hand
you
want a light-weight program without the rendering part of the WebBrowser

or
InternetExplore r controls (ShdocVw), and on the other you want to render
elements using the IHTMLElementRen der interface.

Unfortunately you can't use this interface unless you host mshtml

properly,
and that includes the rendering part.

When you load the document below it is not rendered; just loaded into
memory. Therefore you cannot render it to a device context because there

is
no rendered page to copy.

You can continue to manipulate the html as you have below, but if you
want
to render it you must either use the WebBrowser/InternetExplore r controls

or
host mshtml fully yourself.

HTH

Charles
"ddd" <so******@nowhe reforspam.com> wrote in message
news:uO******** ******@TK2MSFTN GP14.phx.gbl...
> Hi,
>
> I am having problems with using the DrawToDC of the
> MSHTML.iHTMLEle mentRender in a VB.net application. For some reason I am
> getting a "catastroph ic error". I am basing the code on c# examples,
> and I > am not sure what exactly I am doing wrong. From the C# posts it seems that > the drawtodc has a bug and you need to redifine it, so i followed their
> advice and specified an interface as below:
>
>
> Imports System
> Imports System.Drawing
> Imports System.Runtime. InteropServices
> Imports mshtml
>
> <ComVisible(Tru e), ComImport(),
> Guid("3050f669-98b5-11cf-bb82-00aa00bdce0b"), _
> InterfaceTypeAt tribute(ComInte rfaceType.Inter faceIsIUnknown) > _
> Interface IHTMLElementRen der
> Sub DrawToDC(<[In]()> ByVal hDC As IntPtr)
> Sub SetDocumentPrin ter(<[In](), MarshalAs(Unman agedType.BStr)> ByVal
> bstrPrinterName As String, <[In]()> ByVal hDC As IntPtr)
> End Interface 'IHTMLElementRe nder
>
> On the main form of the application I am doing the following:
>
> Dim objMSHTML As HTMLDocument
> Dim objDocument As IHTMLDocument2
> Dim ips As IPersistStreamI nit
>
> objMSHTML = New HTMLDocument()
>
> ips = DirectCast(objM SHTML, IPersistStreamI nit)
> ips.InitNew()
>
> objDocument =
> objMSHTML.creat eDocumentFromUr l("http://www.google.com" , String.Empty)
>
> Do Until objDocument.rea dyState = "complete"
> Application.DoE vents()
> Loop
>
> MsgBox(objDocum ent.body.outerH TML)
> Dim bodyElement As IHTMLElement
> Dim render As IHTMLElementRen der
>
>
> If objDocument.bod y.outerHTML <> Nothing Then
> bodyElement = objDocument.bod y
> render = bodyElement
> Dim img As New Bitmap(600, 400)
> Dim g As Graphics = Graphics.FromIm age(img)
> Dim memDC As IntPtr
> memDC = g.GetHdc()
>
> Try
> render.DrawToDC (memDC)
> Catch ex As Exception
> MsgBox(ex.ToStr ing)
> End Try
>
>
> End If
>
> It seems like I am getting the HTML document just fine, is just that when > I
> try to use DrawToDC to get the application to print/send to the DC i
> Created
> in memory, it causes the error.Any ideas on what I am doing wrong?
>
> Here are the links to where I got the C# examples:
> http://groups.google.com/groups?hl=e...C%2B%2Bfailure > http://blogs.msdn.com/rfarber/archiv...12/240943.aspx
>
> thanks
>
>



Nov 16 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
3061
by: Paul | last post by:
I thought this is more of an IE issue but i've had no joy on that group perhaps somebody here will have a clue. If i click a link to a web page embedded in Excel (97 OR 2000) i get the standard error page displayed by IE (you know, the 'cannot find server or dns error' page). Turning off 'show friendly http error messages' alleviates this. (Unfortunately this is the Windows default setting!) Whats going on?!?!
3
6087
by: Ari Royce Hidayat | last post by:
Dear ALL, Is there some one ever faces this problem? And fix it? The scenario is: There's an html page that hosts a .net object (using object tag), and this page opens the second html page that also hosts a .net object (e.g. by click a hyperlink).
0
1708
by: Ari Royce Hidayat | last post by:
Tx a lot for idea. I've tried it, and still get not clue what causes it. I also tried to see the log file generated by IEHost (by adding IEHostLogFile to registry) and still get not clue what causes. It seems normal instead that before loading the second page (in third row from last row) there's a text read as:
17
27281
by: Ange T | last post by:
Hi there, I'm having pain with the VB behind an Access form. The form is used to create reports in Excel based on the details entered in the form. This has always worked without error on my machine (NT4, Access 2k), however as soon as I attempt to create anything on another machine (NT4, Access 2k) which most users will be working from, I receive an automation error. The problem line with the code is:
2
3197
by: Jonathan Trevor | last post by:
Hi, For the last couple of releases of a product we're developing we've been running to very wierd behavior from IE and our ASP.NET web application which serves up various types of files and I'm getting very frustrated in trying to solve it! We content we are serving up is potentially sensitive and therefore we DO NOT want it cached on the remote client (IE) beyond the lifetime of the application rendering it (IE, Powerpoint, Word...
1
2987
by: Philipp Schumann | last post by:
In one of my web developments, the Application_End event occurs several times while a user browses the pages. Because I make use of extensive session tracking and also provide a couple of services that need the session state, that is highly problematic as the sessions are abandoned when the application ends. I have observed this behaviour for quite a while now, locally as well as on the web, so it must be due to some of my code. Is there...
7
634
by: ddd | last post by:
Hi, I am having problems with using the DrawToDC of the MSHTML.iHTMLElementRender in a VB.net application. For some reason I am getting a "catastrophic error". I am basing the code on c# examples, and I am not sure what exactly I am doing wrong. From the C# posts it seems that the drawtodc has a bug and you need to redifine it, so i followed their advice and specified an interface as below:
5
12306
by: Neil Rossi | last post by:
I have an issue with a particular ASP page on two web servers. Let's call these servers Dev1 and Beta1. Both Servers are running IIS 5, Windows 2000 SP4 with "almost" all of the latest patches. On Beta1, I am able to execute a particular page with no problem, that page opens up in the comes up just fine. On Win2kdev1, when I go to execute the same page, it opens a file download dialog and asks me whether I want to open or save the...
6
3413
by: DFS | last post by:
One of my systems grew exponentially - from 13mb to 43mb - after adding some 10 temp tables (with no data), a new form, and about a thousand lines of code. The .mdb has mostly table links, lots of forms and queries, and a good bit of code overall. But 43mb is totally unreasonble. I can't figure out where the problem is occurring. It was fine for a long time. I even created a new file and imported the objects and it blew back up to...
2
2475
by: google | last post by:
I statically link the Synopsys Milkyway C-API library ("MDA") into my C++ application. When my C++ application throws an exception, it seg faults instead. The details of my environment are: x86 (Pentium) CPU or AMD x86_64 (Opteron) Red Hat Enterprise Linux 3 OS gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-54) Also reproduced with gcc version 3.3.2
0
8774
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9447
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6735
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6031
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4809
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.