Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 239
  • Last Modified:

Webbrowser or DHTMLEdit Control ?

Hello ! I am designing a Webpage editor application.
I use therefore the webbrowser control with its designmode to on.
But there are many problems .The webbrowser control does not have source code preservation and does not act to events and many more.

I want to ask : i have been said to use the webbrowser control because microsoft does not support any more the Dhtmledit control and that it does have lots of bugs. Is it necessary that i should use the Webbrowser control ? Are really many bugs in the DHTMLEdit control ? and does this control not comply to new HTML standards ?


Thanks !

alexandros

0
alexr123
Asked:
alexr123
  • 3
  • 3
1 Solution
 
RhaedesCommented:
Hello again...
The link below is to Microsoft's own article on the DHTMLEdit. Click on the link 'What Ever Happened to the DHTML Edit Control?' (which, coming from Microsoft, kinda says it all!)

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnmshtml/html/mshtmleditplatf.asp

Simply put, I can think of no good reason why you should use the old DHTMLEdit when you can use the Webbrowser. If you have come up against a problem (something you could do with the DHTMLEdit but not with the Webbrowser) it is probably simply because they do things slightly differently. Granted, some things are *slightly* easier to do with the DHTMLEdit, because it was designed for the job of editing, but there is, I beleive, nothing that cannot be reproduced in the webbrowser with 2 or 3 lines of code.

I wonder what others think?

Kindest regards,
Rhaedes
0
 
alexr123Author Commented:
Thank you again dear Rhaedes for replying.
The problem with the webbrowser control is that it does not support source code preservation.
And i am designing a webpage editor application that also has a code view .

i also have seen that you saw my post at
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20518797.html
please reply if you can.

the problem with the webbrowser control is moreover that you cannot easily trap events . for example i am designing a ruler and what to trap the mousemove event for the webbrowser control. while the dhtmledit has a mousemove event the webbrowser control does not.

regards,
alex


0
 
RhaedesCommented:
...Hi again. Let's see if we're on the same page. The Webbrowser has a few events associated with it, but mousemove is not one of them. HOWEVER, the HTML Document inside the Webbrowser IS very rich in events (has about 40), and DOES include a generic onmousemove.

1) Open a new exe project.
2) Add a REFERENCE to Microsoft HTML Object Library
3) In the Declarations section of your form add the following:
Private WithEvents Hdoc As HTMLDocument
4) Your project can now listen for events in the HTML document. Test this is the following way: At the top of your code window you have two drop-down menus. The one on the left should now contain the three items:
(General)
 Form
 Hdoc
Select Hdoc.
5) In the other drop-down, you have all the events associated with the HTML document, including onmousemove.
6) Of course, at this stage, the Hdoc isn't wired up to any document, so add a webbrowser control to the form., and make sure it loads a document (albeit a blank one) by add ing the code

Private Sub Form_Load()
WebBrowser1.Navigate2 ("about:blank")
End Sub

7) Finally, to hook up the document and the Object, add the code below:

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Set Hdoc = WebBrowser1.Document
End Sub

8) Now you're set. As I say, one of the document events is onmousemove, so you can use
 
Private Sub Hdoc_onmousemove()
'do stuff
End Sub


Hope this helps.
Kindest regards,
Rhaedes
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
alexr123Author Commented:
Thanks !
Just reply here
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20518797.html

and i will give you the 250 points.

i guess there is no way for source code preservation with the webbrowser control. i thought something that preserves
the code view and each time from the menu you insert html
you calculate what to insert manually.
for example
to insert an image you do not use the webbrowser DOM
but instead do something like this textbox.seltext="<img src="........"> "

the problem is to find where to insert this. i have found
a solution that is not that accurate but it seems to work.

best regards,
alex




0
 
RhaedesCommented:
Hi again.
Source code preservation: Surely what you really need is for the source code to be reformatted 'prettily' every time some thing is added. This is what FrontPage does. You could take a look at http://www.qbdsoftware.co.uk/moth/qweb/format.htm for how to do this.

Also, what about doing the following:
1) Store your source code in a variable
2) Let the user insert something in the WYSIWYG
3) Compare the new HTML with the original source code (say from the body tag, and find the point of divergence of the two strings.
4) Get the added HTML string
5) Insert the string into the original source code string at the point of divergence
6) Write the string back into the webbrowser.

It should work, but its tiresome to do.

Finally, with regard to the other question you posted: why don't you post a message at community support to delete the question and refund your points? It's really not fair to change questions half-way - not least because in a google search the results would be confusing.

Kindest regards,
Rhaedes
0
 
alexr123Author Commented:
ok i will i did not know i could do this

cheers,
alex
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now