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.HTMLDocu ment
Try
Dim htm As mshtml.HTMLDocu ment = AxWebBrowser1.D ocument
GetDocument = htm
Catch
Throw (New Exception("Cann ot retrieve the document from the
WebBrowser" + _
"Control: " + Err.GetExceptio n().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 IOleCommandTarg et
Dim o As Object
Try
cmdt = CType(GetDocume nt(), IOleCommandTarg et)
cmdt.Exec(cmdGU ID,
Convert.ToUInt3 2(MiscCommandTa rget.ViewSource ), _
Convert.ToUInt3 2
SHDocVw.OLECMDE XECOPT.OLECMDEX ECOPT_DODEFAULT ), o, o)
Catch
Throw (New Exception(Err.G etException().M essage))
End Try
End Sub
If I replace GetDocument() (which didn't work, see above), with
WebBrowser1.Doc ument, it says can't cast WebBrowser1.Doc ument to
IOleCommandTarg et.
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 7539
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.goo glegroups.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.HTMLDocu ment Try Dim htm As mshtml.HTMLDocu ment = AxWebBrowser1.D ocument GetDocument = htm Catch Throw (New Exception("Cann ot retrieve the document from the WebBrowser" + _ "Control: " + Err.GetExceptio n().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 IOleCommandTarg et Dim o As Object
Try cmdt = CType(GetDocume nt(), IOleCommandTarg et) cmdt.Exec(cmdGU ID, Convert.ToUInt3 2(MiscCommandTa rget.ViewSource ), _ Convert.ToUInt3 2 SHDocVw.OLECMDE XECOPT.OLECMDEX ECOPT_DODEFAULT ), o, o) Catch Throw (New Exception(Err.G etException().M essage)) End Try End Sub
If I replace GetDocument() (which didn't work, see above), with WebBrowser1.Doc ument, it says can't cast WebBrowser1.Doc ument to IOleCommandTarg et.
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.D ocument before, replace this with
WebBrowser1.Doc ument.DomDocume nt.
HTH
Charles
"Doe" <do*******@aol. com> wrote in message
news:11******** **************@ e56g2000cwe.goo glegroups.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.HTMLDocu ment Try Dim htm As mshtml.HTMLDocu ment = AxWebBrowser1.D ocument GetDocument = htm Catch Throw (New Exception("Cann ot retrieve the document from the WebBrowser" + _ "Control: " + Err.GetExceptio n().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 IOleCommandTarg et Dim o As Object
Try cmdt = CType(GetDocume nt(), IOleCommandTarg et) cmdt.Exec(cmdGU ID, Convert.ToUInt3 2(MiscCommandTa rget.ViewSource ), _ Convert.ToUInt3 2 SHDocVw.OLECMDE XECOPT.OLECMDEX ECOPT_DODEFAULT ), o, o) Catch Throw (New Exception(Err.G etException().M essage)) End Try End Sub
If I replace GetDocument() (which didn't work, see above), with WebBrowser1.Doc ument, it says can't cast WebBrowser1.Doc ument to IOleCommandTarg et.
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.D ocument before, replace this with WebBrowser1.Doc ument.DomDocume nt.
If it is, do you have for me than a better solution for this one.
DirectCast(WebB rowser1.Documen t.DomDocument,
mshtml.IHTMLDoc ument2).designM ode = "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.D ocument.designM ode = "On"
and
DirectCast(WebB rowser1.Documen t.DomDocument,
mshtml.IHTMLDoc ument2).designM ode = "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******** ********@TK2MSF TNGP12.phx.gbl. .. Charles,
Wherever you had AxWebBrowser1.D ocument before, replace this with WebBrowser1.Doc ument.DomDocume nt. If it is, do you have for me than a better solution for this one.
DirectCast(WebB rowser1.Documen t.DomDocument, mshtml.IHTMLDoc ument2).designM ode = "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 IDocHostUIHandl er interface. I implement it like this
<code>
Public Function GetHostInfo(ByR ef pInfo As DOCHOSTUIINFO) As HRESULT
Implements IDocHostUIHandl er.GetHostInfo
With pInfo
.cbSize = Len(pInfo)
.dwFlags = DOCHOSTUIFLAG.D OCHOSTUIFLAG_DI V_BLOCKDEFAULT Or _
DOCHOSTUIFLAG.D OCHOSTUIFLAG_FL AT_SCROLLBAR Or _
DOCHOSTUIFLAG.D OCHOSTUIFLAG_NO 3DBORDER
.dwDoubleClick = DOCHOSTUIDBLCLK .DOCHOSTUIDBLCL K_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******** ******@TK2MSFTN GP11.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 control displays the
"Common Tasks" section on the left-hand side of the display - I assume it
just shows/hides this based upon the Windows user's settings. Is there any
way to change this to "Classic View", ie to remove the left-side "Common
Tasks"...
|
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.
-Regards
Arun
|
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 Source Option in the Webbrowser control.
This is exactly what I need to do. However, I need to capture the text in a
string. How do I accomplish this without having Notepad. fire up?
Many Thanks
|
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
occur if there is a compilation error in the Web site.
C:\Documents and Settings\...\Local
Settings\Temp\1\VWDWebCache\onlineformsdev.....com\sweepv2\dorequest1.aspx 16
7 http://onlineformsdev.....com/
The source code (start of the...
| |
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 link in a web page using the WebBrowser control in VS
2005 C# Express and .NET 2.0?
|
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 application.
I'm taking an xml file, transforming it with an xslt (XslCompiledTransform)
.. The end result is an html that I want to load into the WebBrowser control
for viewing.
|
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 problem is: When i do that webbrowser in form2 does not run:
In form1 i have that code:
private void button1_Click(object sender, EventArgs e)
{
Form form2 = new Form();
|
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,...
|
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...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
|
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();...
|
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...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
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...
| |