By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,207 Members | 1,416 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,207 IT Pros & Developers. It's quick & easy.

HtmlEditor update

P: n/a
I've posted an update to the HtmlEditor - hosts Msthml in C#. I've removed
the dependency on Microsoft.mshtml. See here:

http://www.itwriting.com/htmleditor

It would be nice to be able to use the DOM in System.Windows.Forms with the
control. You can easily get the unmanaged DomDocument from a managed
HtmlDocument. Does anyone know a way to do the opposite?

Tim
Tech blog: http://www.itwriting.com/blog
May 19 '06 #1
Share this Question
Share on Google+
9 Replies


P: n/a
HI Tim,

Usually an announcement post is preceded with an ANN prefix in the subjetc.
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Tim Anderson" <ti*****@nospam.nospam> wrote in message
news:Og**************@TK2MSFTNGP03.phx.gbl...
I've posted an update to the HtmlEditor - hosts Msthml in C#. I've removed
the dependency on Microsoft.mshtml. See here:

http://www.itwriting.com/htmleditor

It would be nice to be able to use the DOM in System.Windows.Forms with
the control. You can easily get the unmanaged DomDocument from a managed
HtmlDocument. Does anyone know a way to do the opposite?

Tim
Tech blog: http://www.itwriting.com/blog

May 19 '06 #2

P: n/a
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:Om**************@TK2MSFTNGP03.phx.gbl...
Usually an announcement post is preceded with an ANN prefix in the
subjetc.


Well, it was a question as well as an ANN. Any ideas?

Tim
Tech blog:
http://www.itwriting.com/blog
May 19 '06 #3

P: n/a
Hi,

Opps, sorry I did not read the last sentence

And no, I don;t know how to do so. and frankly don't think that the
unmanaged DOM keeps a reference to the containing HtmlDocument
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
May 19 '06 #4

P: n/a
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:eN**************@TK2MSFTNGP04.phx.gbl...
And no, I don;t know how to do so. and frankly don't think that the
unmanaged DOM keeps a reference to the containing HtmlDocument


The unmanaged DOM has no knowledge of any .NET classes. However I'd have
thought there could be a constructor somewhere that creates a managed
HtmlDocument from a reference to an unmanaged HTMLDocument, without actually
displaying it in the WebBrowser control.

Tim
Tech blog: http://www.itwriting.com/blog
May 19 '06 #5

P: n/a
Hi Tim,

I think you may try the method below.
NOTE: you need to have the interface and the interface must be valid. That
is to say, the interface should be pointed to an Object which have been
created.
Marshal.GetObjectForIUnknown Method
http://msdn2.microsoft.com/en-US/lib...pservices.mars
hal.getobjectforiunknown.aspx

Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

May 22 '06 #6

P: n/a
""Peter Huang" [MSFT]" <v-******@online.microsoft.com> wrote in message
news:mR**************@TK2MSFTNGXA01.phx.gbl...
I think you may try the method below.
NOTE: you need to have the interface and the interface must be valid. That
is to say, the interface should be pointed to an Object which have been
created.
Marshal.GetObjectForIUnknown Method


Peter,

Thanks for the suggestion. You may have misunderstood the requirement. This
method (and the similar Marshal.GetTypedObjectForIUnknown) can only return a
wrapper generated by the type library importer. This is not the case with
System.Windows.Forms.HtmlDocument.

Tim
Tech blog: http://www.itwriting.com/blog
May 22 '06 #7

P: n/a
Hi Tim,

I understand your scenario, if you look at the HTMLDocument class, it did
not include a ctor or a method to create a HTMLDocument based on a
IHTMLDocument interface. Actually this is somewhat a kind of .NET wrap.

If we look into the HTMLDocument class in MSDN, we will get the definition
as below.
Note: This class is new in the .NET Framework version 2.0.
Provides top-level programmatic access to an HTML document hosted by the
WebBrowser control.

As you said, the unmanaged HTMLDocument interface did not include a
reference to a managed HTMLDocument class.
So according to the document, the HTMLDocument class is used to help to
access to an HTML document hosted by the WebBrowser control. That is why it
did not have a ctor to create a HTMLDocument.

Also from your description below
"It would be nice to be able to use the DOM in System.Windows.Forms with
the
control. You can easily get the unmanaged DomDocument from a managed
HtmlDocument. Does anyone know a way to do the opposite?"

So I understand that you already have a unmanaged DomDocument, and you want
to get its managed reference. As you said in the previous post,
Marshal.GetTypedObjectForIUnknown will get a wrapper generated by MSHTML
COM TypeLib which is provided by MS. I just wonder why you did not want use
the wrapper. If you do not want to use MSHTML library in .NET, I think you
have to build one HTML .NET wrapper yourself. This should be complex job,
if you do wanna do that, I suggest you contact MSPSS directly.

http://support.microsoft.com

If I have any misunderstanding or you have any concern, please feel free to
post here.

Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

May 23 '06 #8

P: n/a
""Peter Huang" [MSFT]" <v-******@online.microsoft.com> wrote in message
news:x3**************@TK2MSFTNGXA01.phx.gbl...
Hi Tim,

I understand your scenario, if you look at the HTMLDocument class, it did
not include a ctor or a method to create a HTMLDocument based on a
IHTMLDocument interface. Actually this is somewhat a kind of .NET wrap.
Yes - there is a constructor of course but it is marked internal so not
accessible.
So I understand that you already have a unmanaged DomDocument, and you
want
to get its managed reference. As you said in the previous post,
Marshal.GetTypedObjectForIUnknown will get a wrapper generated by MSHTML
COM TypeLib which is provided by MS. I just wonder why you did not want
use
the wrapper.
Just to be clear, there are two wrappers under discussion here. There is the
..NET 2.0 wrapper which is part of the Framework (HtmlDocument etc), and
Microsoft.Mshtml which is the PIA for MSHTML. It's the former that I want to
use, not the latter. The main problem with the latter, by the way, is its
large size and the fact that it is not distributed with dotnetfx.exe but has
to be deployed separately; there are also some bugs in its implementation.

If you look at the documentation for the .NET 2.0 wrapper (as opposed to the
PIA), you'll note that it is only a subset of what is in MSHTML. Further,
the WebBrowser control does not offer an edit mode; you can set designmode
on via DomDocument, but there seem to be some bugs and problems with this
(I've not fully investigated). In addition, there are scenarios where you
might want to process HTML without displaying anything in the WebBrowser
control.
If you do not want to use MSHTML library in .NET, I think you
have to build one HTML .NET wrapper yourself. This should be complex job,


Yes, this is what I've done; but I find it frustrating that you can't use
the nice MSHTML wrapper built into .NET Framework 2.0 for documents that are
not loaded into the WebBrowser control.

My wrapper is here:

http://www.itwriting.com/htmleditor/index.php

Tim
May 23 '06 #9

P: n/a
Hi Tim,

I do understand your concern in this scenario, I highly suggest you can
submit this feedback to our product feedback center:

http://lab.msdn.microsoft.com/produc...k/default.aspx

Our feedback team will consider your suggestion and keep improving our
product.

Thanks for your understanding!
Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

May 24 '06 #10

This discussion thread is closed

Replies have been disabled for this discussion.