Hiya,
I'm using mshtml and the web browser control to embed an OLE object in my
..NET application.
What I want to do is get a reference to the "object" embedded therein:
The HTML looks something like this:
<html>
<body>
<object classid="clsid: 260AACA0-F963-101B-8955-0000C0DCD465"
id="TgControl" width="100%" height="100%" border="1" ></object>
</body>
</html>
I am loading the above HTML with the Browser.Navigat e2 command and all is
well. Now, I can fetch the Document Object Model of the web page using:
Dim myDoc As HTMLDocument = New HTMLDocumentCla ss
myDoc = CType(Browser.D ocument, HTMLDocument)
But how can I get a reference to the actual embedded item "TgControl" from
the object model?
Any hints greatly appreciated.
Robin 7 6920
Hi Robin,
When I was you I would start with it in VB.net with Option Strict of.
A sample to get the first href (This is all with early binding)
Watch typos or other errors I copied it from a class however not complete so
someparts can be very good wrong.
It is just to give you the idea.
I hope this helps?
Cor
myDoc = CType(Browser.D ocument, mshtml.IHTMLDoc ument2)
For i as integer = 0 To MyDoc.all.lengt h - 1
Dim hElm as mshtml.IHTMLEle ment= DirectCast(MyDo c.all.item(i),
mshtml.IHTMLEle ment)
If (hElm.tagName = "a") Then
If Not DirectCast(hElm , mshtml.IHTMLAnc horElement).hre f Is Nothing
Then
hrefname = DirectCast(hElm ,
mshtml.IHTMLAnc horElement).hre f.ToString
'do Something
End if
End If
next I'm using mshtml and the web browser control to embed an OLE object in my .NET application.
What I want to do is get a reference to the "object" embedded therein:
The HTML looks something like this:
<html> <body> <object classid="clsid: 260AACA0-F963-101B-8955-0000C0DCD465" id="TgControl" width="100%" height="100%" border="1" ></object> </body> </html>
I am loading the above HTML with the Browser.Navigat e2 command and all is well. Now, I can fetch the Document Object Model of the web page using:
Dim myDoc As HTMLDocument = New HTMLDocumentCla ss myDoc = CType(Browser.D ocument, HTMLDocument)
But how can I get a reference to the actual embedded item "TgControl" from the object model?
Any hints greatly appreciated. Robin
Ok, I can see what you are doing here Cor, but the problem is I have an
object embedded of the class 260AACA0-F963-101B-8955-0000C0DCD465 - what I
want to do is get an IntPtr (or something) to this data blob so that I can
manipulate it while it is embedded in the web browser control.
By looking at the properties of "myDoc" with the debugger, I can see that
the HTML I have shown below results in the "Applet" collection having a
single item in it. I'm guessing this is something to do with my TgControl
object. Now what I want is to get access to this object so I can manipulate
it.
Does this make sense?
Thanks.
"Cor Ligthert" <no**********@p lanet.nl> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. .. Hi Robin,
When I was you I would start with it in VB.net with Option Strict of.
A sample to get the first href (This is all with early binding) Watch typos or other errors I copied it from a class however not complete
so someparts can be very good wrong.
It is just to give you the idea.
I hope this helps?
Cor
myDoc = CType(Browser.D ocument, mshtml.IHTMLDoc ument2) For i as integer = 0 To MyDoc.all.lengt h - 1 Dim hElm as mshtml.IHTMLEle ment= DirectCast(MyDo c.all.item(i), mshtml.IHTMLEle ment) If (hElm.tagName = "a") Then If Not DirectCast(hElm , mshtml.IHTMLAnc horElement).hre f Is Nothing Then hrefname = DirectCast(hElm , mshtml.IHTMLAnc horElement).hre f.ToString 'do Something End if End If next
I'm using mshtml and the web browser control to embed an OLE object in
my .NET application.
What I want to do is get a reference to the "object" embedded therein:
The HTML looks something like this:
<html> <body> <object classid="clsid: 260AACA0-F963-101B-8955-0000C0DCD465" id="TgControl" width="100%" height="100%" border="1" ></object> </body> </html>
I am loading the above HTML with the Browser.Navigat e2 command and all
is well. Now, I can fetch the Document Object Model of the web page using:
Dim myDoc As HTMLDocument = New HTMLDocumentCla ss myDoc = CType(Browser.D ocument, HTMLDocument)
But how can I get a reference to the actual embedded item "TgControl"
from the object model?
Any hints greatly appreciated. Robin
"Robin Tucker" <id************ *************@r eallyidont.com> wrote in
message news:ca******** ***********@new s.demon.co.uk.. . Hiya,
I'm using mshtml and the web browser control to embed an OLE object in my .NET application.
What I want to do is get a reference to the "object" embedded therein:
No idea regarding your question but wouldn't it be easier to locate the .dll
or .ocx file containing this object and adding it directly on your form
instead of passing through the Web Browser control? Not all IE embeddable
objects can be ambedded in a Window Form but i've done that succesfully with
quite a few of them.
Hi Robin,
Nice idea, however I would first try with that sample I gave you try to get
the information.
Probably is the equivalent from IHTMLAnchorElem ent for the object
IHTMLObjectElem ent.
I was currious and I typed it in in MSDN, and there it was :) http://msdn.microsoft.com/library/de...ement/type.asp
Every element has something like that conform the DOM. From than I would do
that other step to get to the real applet object in mem, however from that I
donnot know how, although it sounds very interesting.
Cor
Cor and Robin,
If you can get the IHTMLObjectElem ent interface, then you can use the
object property to get the actual object (and cast it to whatever you wish).
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Cor Ligthert" <no**********@p lanet.nl> wrote in message
news:eJ******** ******@TK2MSFTN GP10.phx.gbl... Hi Robin,
Nice idea, however I would first try with that sample I gave you try to
get the information. Probably is the equivalent from IHTMLAnchorElem ent for the object IHTMLObjectElem ent. I was currious and I typed it in in MSDN, and there it was :)
http://msdn.microsoft.com/library/de...ement/type.asp Every element has something like that conform the DOM. From than I would
do that other step to get to the real applet object in mem, however from that
I donnot know how, although it sounds very interesting.
Cor
Cheers guys - I didn't see the object property. Actually, the
HTMLObjectEleme nt class in mshtml does not have the object property,
although the IHTMLObjectElem ent interface does. This is what threw me!
Now its all working well. Thanks.
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in
message news:%2******** *******@TK2MSFT NGP11.phx.gbl.. . Cor and Robin,
If you can get the IHTMLObjectElem ent interface, then you can use the object property to get the actual object (and cast it to whatever you
wish). Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard. caspershouse.co m
"Cor Ligthert" <no**********@p lanet.nl> wrote in message news:eJ******** ******@TK2MSFTN GP10.phx.gbl... Hi Robin,
Nice idea, however I would first try with that sample I gave you try to get the information. Probably is the equivalent from IHTMLAnchorElem ent for the object IHTMLObjectElem ent. I was currious and I typed it in in MSDN, and there it was :)
http://msdn.microsoft.com/library/de...ement/type.asp Every element has something like that conform the DOM. From than I would
do that other step to get to the real applet object in mem, however from
that I donnot know how, although it sounds very interesting.
Cor
oh please don't go there. That couldn't be done so we decided to create an
ActiveX control by adding the required interfaces to our OLE component. Hey
presto - shaggage! WinForms doesn't seem to like it very much, particularly
the out-of-processness of it. We get deadlock. So, as a last resort (well
not actually, a last resort would be scrapping the current OLE control and
totally re-writing the suite, which would take about 2 years) we are
embedding into a browser. If that doesn't work, embedding into Microsoft
Word within a browser, etc.
"Elp" <ro********@REM OVEME.hotmail.c om> wrote in message
news:eW******** ******@tk2msftn gp13.phx.gbl... "Robin Tucker" <id************ *************@r eallyidont.com> wrote in message news:ca******** ***********@new s.demon.co.uk.. . Hiya,
I'm using mshtml and the web browser control to embed an OLE object in
my .NET application.
What I want to do is get a reference to the "object" embedded therein: No idea regarding your question but wouldn't it be easier to locate the
..dll or .ocx file containing this object and adding it directly on your form instead of passing through the Web Browser control? Not all IE embeddable objects can be ambedded in a Window Form but i've done that succesfully
with quite a few of them.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Pablo J Royo |
last post by:
Hello:
i have a function that reads a file as an argument and returns a reference
to an object that contains some information obtained from the file: FData
&ReadFile(string FilePath);
But , for example, when the file doesnt exists, i should not return any
reference to a bad constructed object, so i need something as a NULL
reference object. I suppose i could return a pointer instead, but i have
some code written with references which...
|
by: Kam |
last post by:
Hi!
When I am trying to drag user controls or any controls from the Toolbox to a
form in some of my projects I get a dialog messages: (Microsoft Deployment
Environment)
"Object reference not set to an instance of an object"
Notes that:
1. It's a designer problem, not a reference problem. When I am adding this
user control directly to the code it works just fine, but I can't make it
|
by: Tim Johnson |
last post by:
Hello All:
I would like to expand upon the typeof operator.
Using 'typeof' I can distinguish between string and
array for instance, because typeof returns "object" for
array.
How can I programmatically distinguish between an Array and an Option,
for instance?
Thanks
|
by: samlee |
last post by:
// create an object
Control obj=new Control();
// How to write c# code to achieve the following pseudo code?
// use an integer to represent an obj
int temp=(int)obj;
// later recover original object
Control obj1=(Control)temp;
TIA
|
by: Robin Tucker |
last post by:
Hiya,
I'm using mshtml and the web browser control to embed an OLE object in my
..NET application.
What I want to do is get a reference to the "object" embedded therein:
The HTML looks something like this:
<html>
| |
by: Chris Magoun |
last post by:
I suddenly received an unexpected error in my project. I have been working
on this project for some time without this issue. Nothing has changed in the
form that caused the exception. A little experimentation shows that I cannot
run ANY .NET web project without getting this error:
----------------------------------------------------------------------------
----
Object reference not set to an instance of an object.
|
by: Chris |
last post by:
Hi,
I tried to create a class which must change the propety 'visible' of a
<linktag in the masterpage into 'false' when the user is logged. But i get
the error: "Object reference not set to an instance of an object"
for the line 'If mpg.FindControl("lkred").Visible = True Then'.
I couldn't find sofar the solution.
Any help would be appreciated ...
Thanks
|
by: Tamer Ibrahim |
last post by:
Hi,
Sometimes, I got the following error message when I use ajax calendar
control on some aspx pages :
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set
to an...
|
by: My Pet Programmer |
last post by:
Ok guys, I'm really looking for someone to tell me how bad a hack this
is, and if I'm close to where I should be with it.
The basic situation is that I have a class which creates a basic
calendar control, the only difference is I stole the navigation scheme
from Vista (e.g., if you click on the year you zoom out to the months
list, then out to the decade, and back in when you click a year, then a
month).
I ran into some trouble...
|
by: Sarah |
last post by:
Hi -
Please be gentle. I am quite new to visual basic, but I have been
going through tutorials and reading up. I found a code snippet on the
internet that I wanted to see if I could re-purpose for a project, but
I keep getting the error: "Object reference not set to an instance of
an object" for the 7th line of the code below which is:
obj.ConvertPage(URL).Save("C:\screencaptest2.bmp",
System.Drawing.Imaging.ImageFormat.Bmp)
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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: 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: 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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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...
| |