I've been trying this for months. Doesn't work.
I've used the code in this article, http://support.microsoft.com/kb/311288/en-us, HOW TO: Invoke the Find,
View Source, and Options Dialog Boxes for the WebBrowser Control from
Visual Basic .NET.
This code worked in VB.Net 2003 but not in VB.Net 2005.
Specifically this doesn't work... (all code is from article)
Private Function GetDocument() As mshtml.HTMLDocument
Try
Dim htm As mshtml.HTMLDocument = AxWebBrowser1.Document
GetDocument = htm
Catch
Throw (New Exception("Cannot retrieve the document from the
WebBrowser" + _
"Control: " + Err.GetException().Message))
End Try
End Function
I get an error message of can't cast WebBrowser1 to mshtml.HTML
Document. In VB.Net 2003, the browser was AxWebBrowser1, in 2005 it has
changed and is WebBrowser1 (for the first instance).
This code also does not work...
Public Sub ViewSource()
Dim cmdt As IOleCommandTarget
Dim o As Object
Try
cmdt = CType(GetDocument(), IOleCommandTarget)
cmdt.Exec(cmdGUID,
Convert.ToUInt32(MiscCommandTarget.ViewSource), _
Convert.ToUInt32
SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DODEFAULT), o, o)
Catch
Throw (New Exception(Err.GetException().Message))
End Try
End Sub
If I replace GetDocument() (which didn't work, see above), with
WebBrowser1.Document, it says can't cast WebBrowser1.Document to
IOleCommandTarget.
Frankly, I didn't understand this code very much in the first place.
:-) But I have tested it in VB.Net 2003 and it works. In 2005 it
doesn't. The browser has changed.
I am wondering if anyone knows how to make it work?
Maybe the codes/addresses changed too as in...
Private cmdGUID As New Guid(&HED016940, -17061, _
&H11CF, &HBA, &H4E, &H0, &HC0, &H4F, &HD7, &H8, &H16)
Or maybe it's something else.
Basically clueless here.
Any help appreciated.
Marnie 7 7522
Doe,
My expirience is that I cannot use the documentation for the AxWebbrowser
for the Webbrowser.
The confusing part is that Microsoft is talking on MSDN about the Webbrowser
where they mean the AxWebbrowser. My only solution is than to look at the
publishing date of the pages.
Cor
"Doe" <do*******@aol.com> schreef in bericht
news:11**********************@e56g2000cwe.googlegr oups.com... I've been trying this for months. Doesn't work.
I've used the code in this article, http://support.microsoft.com/kb/311288/en-us, HOW TO: Invoke the Find, View Source, and Options Dialog Boxes for the WebBrowser Control from Visual Basic .NET.
This code worked in VB.Net 2003 but not in VB.Net 2005.
Specifically this doesn't work... (all code is from article)
Private Function GetDocument() As mshtml.HTMLDocument Try Dim htm As mshtml.HTMLDocument = AxWebBrowser1.Document GetDocument = htm Catch Throw (New Exception("Cannot retrieve the document from the WebBrowser" + _ "Control: " + Err.GetException().Message)) End Try End Function
I get an error message of can't cast WebBrowser1 to mshtml.HTML Document. In VB.Net 2003, the browser was AxWebBrowser1, in 2005 it has changed and is WebBrowser1 (for the first instance).
This code also does not work...
Public Sub ViewSource() Dim cmdt As IOleCommandTarget Dim o As Object
Try cmdt = CType(GetDocument(), IOleCommandTarget) cmdt.Exec(cmdGUID, Convert.ToUInt32(MiscCommandTarget.ViewSource), _ Convert.ToUInt32 SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DODEFAULT), o, o) Catch Throw (New Exception(Err.GetException().Message)) End Try End Sub
If I replace GetDocument() (which didn't work, see above), with WebBrowser1.Document, it says can't cast WebBrowser1.Document to IOleCommandTarget.
Frankly, I didn't understand this code very much in the first place. :-) But I have tested it in VB.Net 2003 and it works. In 2005 it doesn't. The browser has changed.
I am wondering if anyone knows how to make it work?
Maybe the codes/addresses changed too as in...
Private cmdGUID As New Guid(&HED016940, -17061, _ &H11CF, &HBA, &H4E, &H0, &HC0, &H4F, &HD7, &H8, &H16)
Or maybe it's something else.
Basically clueless here.
Any help appreciated.
Marnie
Hi Doe
The WebBrowser hasn't really changed, it has just been hand-wrapped instead
of the earlier auto-wrapping that occurred to create the AxWebBrowser1
object.
Wherever you had AxWebBrowser1.Document before, replace this with
WebBrowser1.Document.DomDocument.
HTH
Charles
"Doe" <do*******@aol.com> wrote in message
news:11**********************@e56g2000cwe.googlegr oups.com... I've been trying this for months. Doesn't work.
I've used the code in this article, http://support.microsoft.com/kb/311288/en-us, HOW TO: Invoke the Find, View Source, and Options Dialog Boxes for the WebBrowser Control from Visual Basic .NET.
This code worked in VB.Net 2003 but not in VB.Net 2005.
Specifically this doesn't work... (all code is from article)
Private Function GetDocument() As mshtml.HTMLDocument Try Dim htm As mshtml.HTMLDocument = AxWebBrowser1.Document GetDocument = htm Catch Throw (New Exception("Cannot retrieve the document from the WebBrowser" + _ "Control: " + Err.GetException().Message)) End Try End Function
I get an error message of can't cast WebBrowser1 to mshtml.HTML Document. In VB.Net 2003, the browser was AxWebBrowser1, in 2005 it has changed and is WebBrowser1 (for the first instance).
This code also does not work...
Public Sub ViewSource() Dim cmdt As IOleCommandTarget Dim o As Object
Try cmdt = CType(GetDocument(), IOleCommandTarget) cmdt.Exec(cmdGUID, Convert.ToUInt32(MiscCommandTarget.ViewSource), _ Convert.ToUInt32 SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DODEFAULT), o, o) Catch Throw (New Exception(Err.GetException().Message)) End Try End Sub
If I replace GetDocument() (which didn't work, see above), with WebBrowser1.Document, it says can't cast WebBrowser1.Document to IOleCommandTarget.
Frankly, I didn't understand this code very much in the first place. :-) But I have tested it in VB.Net 2003 and it works. In 2005 it doesn't. The browser has changed.
I am wondering if anyone knows how to make it work?
Maybe the codes/addresses changed too as in...
Private cmdGUID As New Guid(&HED016940, -17061, _ &H11CF, &HBA, &H4E, &H0, &HC0, &H4F, &HD7, &H8, &H16)
Or maybe it's something else.
Basically clueless here.
Any help appreciated.
Marnie
Charles, Wherever you had AxWebBrowser1.Document before, replace this with WebBrowser1.Document.DomDocument.
If it is, do you have for me than a better solution for this one.
DirectCast(WebBrowser1.Document.DomDocument,
mshtml.IHTMLDocument2).designMode = "On"
If I do this with the AxWebBrowser which does not need the cast, than it has
in my opinion other results than with the WebBrowser. (In this case with the
webbrowswer the form is first "optimized" in a way I don't want, and it adds
with every "Enter" (not with a Shift Enter) a Div part while I want only a
<br>.). It has much more automatic behaviour.
I don't want that behaviour.
Have you a solution for me with the webbrowser. (I did this in past with the
axWebbrowser and know how to do that).
Cor
Hi Cor
Are you saying that
AxWebBrowser1.Document.designMode = "On"
and
DirectCast(WebBrowser1.Document.DomDocument,
mshtml.IHTMLDocument2).designMode = "On"
behave differently between the two controls? I haven't noticed that
particularly.
In what way do you mean that the form is "optimized", and what automatic
behaviour are you referring to?
When I press Enter on the old AxWebBrowser1 control I get <P> inserted into
the document, unless I implement GetHostInfo() to change it, in which case I
get <DIV>. I don't know of a setting that causes <br> to be inserted when
the Enter key is pressed, unless you override the behaviour of the Enter
key.
I choose the <DIV> because it has the same appearance as a single-spaced new
paragraph, whereas <P> appears to be a double-spaced new paragraph.
Charles
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl... Charles,
Wherever you had AxWebBrowser1.Document before, replace this with WebBrowser1.Document.DomDocument. If it is, do you have for me than a better solution for this one.
DirectCast(WebBrowser1.Document.DomDocument, mshtml.IHTMLDocument2).designMode = "On" If I do this with the AxWebBrowser which does not need the cast, than it has in my opinion other results than with the WebBrowser. (In this case with the webbrowswer the form is first "optimized" in a way I don't want, and it adds with every "Enter" (not with a Shift Enter) a Div part while I want only a <br>.). It has much more automatic behaviour.
I don't want that behaviour.
Have you a solution for me with the webbrowser. (I did this in past with the axWebbrowser and know how to do that).
Cor
Charles,
I was in doubt if I would correct that part of the <br> however thought that
you would understand this as a kind of typo from me.
I did mean the <p> the shift enter I refered to is the <br>. When I press Enter on the old AxWebBrowser1 control I get <P> inserted into the document, unless I implement GetHostInfo() to change it, in which case I get <DIV>. I don't know of a setting that causes <br> to be inserted when the Enter key is pressed, unless you override the behaviour of the Enter key.
This GetHostInfo() is interesting I did not know it so I did not implement
it as well not.
However this standard added (I thought even replaced) in my situation where
I start with the part <Body etc.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<META content="MSHTML 6.00.2900.2802" name=GENERATOR></HEAD>
<BODY>Hi Charles </BODY></HTML>
Cor
Cor This GetHostInfo() is interesting I did not know it so I did not implement it as well not.
It is on the IDocHostUIHandler interface. I implement it like this
<code>
Public Function GetHostInfo(ByRef pInfo As DOCHOSTUIINFO) As HRESULT
Implements IDocHostUIHandler.GetHostInfo
With pInfo
.cbSize = Len(pInfo)
.dwFlags = DOCHOSTUIFLAG.DOCHOSTUIFLAG_DIV_BLOCKDEFAULT Or _
DOCHOSTUIFLAG.DOCHOSTUIFLAG_FLAT_SCROLLBAR Or _
DOCHOSTUIFLAG.DOCHOSTUIFLAG_NO3DBORDER
.dwDoubleClick = DOCHOSTUIDBLCLK.DOCHOSTUIDBLCLK_DEFAULT
.pchHostCss = 0
.pchHostNS = 0
End With
Return HRESULT.S_OK
End Function
</code>
I start my documents with an empty body tag (as well as the rest that you
showed), and then every time I press the Enter key it adds
<DIV> </DIV>.
Actually, I should paste this into another post that I spotted, as it turns
off the 3D-border that someone else was trying to do.
Charles
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:OI**************@TK2MSFTNGP11.phx.gbl... Charles,
I was in doubt if I would correct that part of the <br> however thought that you would understand this as a kind of typo from me.
I did mean the <p> the shift enter I refered to is the <br>.
When I press Enter on the old AxWebBrowser1 control I get <P> inserted into the document, unless I implement GetHostInfo() to change it, in which case I get <DIV>. I don't know of a setting that causes <br> to be inserted when the Enter key is pressed, unless you override the behaviour of the Enter key.
This GetHostInfo() is interesting I did not know it so I did not implement it as well not.
However this standard added (I thought even replaced) in my situation where I start with the part <Body etc.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=Content-Type content="text/html; charset=utf-8"> <META content="MSHTML 6.00.2900.2802" name=GENERATOR></HEAD> <BODY>Hi Charles </BODY></HTML>
Cor
Charles,
That did the trick! Boy, is that a relief, been struggling with this
for months. Well, actually, been working on other aspects of the
program, but I kept coming back to find and view source and trying to
figure out what to do. Had almost decided to make my own find box,
which would be a major PITA.
THANKS a lot! Big weight off. Hope you see this post.
Doe :-) (aka Marnie) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Lorem Ipsum |
last post by:
interesting! I just found a page in which Explorer's View Source does
nothing! How did they do that?
|
by: Tony Meier |
last post by:
I am using the WebBrowser control (Explorer.Shell.2) from within a VBA
application, embedded on an MS Access form to display the contents of a
local folder. By default on Windows 2000/XP the...
|
by: Arun |
last post by:
Hi,
I have simple question to ask. How to write multiple Binary files to the
Browser using Asp.Net and Visual C#.net
I have seen examples where single binary file is written to browser.
...
|
by: Gordon |
last post by:
Microsoft Knowledge Base Article - 311288 . HOW TO: Invoke the Find, View
Source, and Options Dialog Boxes for the WebBrowser Control from Visual
Basic .NET.
This article demonstrates the View...
|
by: Robert |
last post by:
I have a large web site converted from 1.1 to 2.0 and in VS 2005, the IDE
complains that in the ASPX file (html source):
Error 1 Element 'stylesheet' is not a known element. This can...
|
by: Shishu Das |
last post by:
How can I get the page source from a browser window running on the same
box as my program?
shishudas
*** Sent via Developersdex http://www.developersdex.com ***
|
by: cweeks78681 |
last post by:
I am porting some VB6 code that automates navigation through a web page
by getting all the <a> tags into a collection and then calling the
Click method on the appropriate one.
How do I click a...
|
by: Fritz Switzer |
last post by:
Hello,
I'm looking for a code snippet that will demonstrate how to load a
stand-alone "html" file in a WebBrowser control (the one that ships with VS
2005) that I am using as part of a WinForms...
|
by: kimiraikkonen |
last post by:
Hi,
I'm using Visual C# .NET 2005, i have 2 forms when a button in form1
is clicked, second form must be shown, and second form (form2) has
webbrowser control associated to run on load time.
the...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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...
|
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,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
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...
| |