Link to home
Start Free TrialLog in
Avatar of alexr123
alexr123

asked on

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

ASKER CERTIFIED SOLUTION
Avatar of Rhaedes
Rhaedes

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of alexr123
alexr123

ASKER

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
https://www.experts-exchange.com/questions/20518797/Sending-email-with-VB-without-showing-the-default-email-program.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


...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
Thanks !
Just reply here
https://www.experts-exchange.com/questions/20518797/Sending-email-with-VB-without-showing-the-default-email-program.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




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
ok i will i did not know i could do this

cheers,
alex