|
I'm new to using the IE control (MSHTML) and am not sure how to do something. I know it should be possible. Here it is:
If I have an object embedded in an HTML page and I display that page within the IE control, how do I get it programmatically? It has an ID and all of that.
<br />
<!-- DHTML Editing control Object. This will be the body object for the toolbars. --><br />
<object ID="tbContentElement" CLASS="tbContentElement" CLASSID="clsid:2D360201-FFF5-11D1-8D03-00A0C959BC0A" VIEWASTEXT><br />
<param name=Scrollbars value=true><br />
</object><br />
How do I get programmatic access to the tbContentElement object?
Any help, tips, or pointers to articles or whatever are/will be greatly appreciated.
Thanks,
Mike
|
|
|
|
|
You must use IHTMLDocument2 interface. You can find some help on msdn.microsoft.com :
http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/mshtml/reference/reference.asp
example of function to retrieve the value of a tag in a html page :
CString YourApp::GetTagValue(LPDISPATCH lpDispatch, CString strTagId)
{
CString strVal = "";
IHTMLDocument2* pHTMLDocument2 = NULL;
if (lpDispatch == NULL)
return "";
HRESULT hr = lpDispatch->QueryInterface(IID_IHTMLDocument2, (LPVOID*)&pHTMLDocument2);
lpDispatch->Release();
if (hr != S_OK)
return "";
IHTMLElementCollection *pElementCollection = NULL;
hr = pHTMLDocument2->get_all(&pElementCollection);
if (hr != S_OK || pElementCollection == NULL)
return "";
long nElt = 0;
if (pElementCollection->get_length(&nElt) != S_OK)
return "";
for (int i=0; i<nelt; i++)
="" {
="" variant="" varindex,="" var2;
="" varindex.vt="VT_UINT;
" varindex.lval="i;
" variantinit(&var2);
=""
="" idispatch*="" pdisp="NULL;
" hr="pElementCollection-">item(varIndex, var2, &pDisp);
if (hr == S_OK && pDisp != NULL)
{
IHTMLElement* pElem = NULL;
hr = pDisp->QueryInterface(IID_IHTMLElement, (void**)&pElem);
if (hr == S_OK && pElem != NULL)
{
BSTR bstrId = 0, bstrVal = 0;
hr = pElem->get_id(&bstrId);
CString strId(bstrId);
strId.MakeLower();
// Oups, we find our tag !!!
if (strId.Find(strTagId) != -1 && strId != "")
{
// Retrieve all html code
pElem->get_innerHTML(&bstrVal);
strVal = CString(bstrVal);
}
pElem->Release();
}
pDisp->Release();
}
}
pElementCollection->Release();
return strVal;
}
you can use this function like this:
CString strValue = GetTagValue(m_web.GetDocument(), "myid");
With a object embedded in a html page, I think you must use the IHTMLObjectElement interface instead of the IHTMLElement interface.
This is not easy to play with the syntax of theses interfaces, but it works.... Good luck !!!
|
|
|
|
|
Thanks! This will get me started.
|
|
|
|
|
I have a client that needs to do Powerpoint presentations from his web site.
Does anyone know of any example of this using ASP.NET (C# or VB.NET).
Thanks
Tony
|
|
|
|
|
Why not just put the ppt file out on the web site and add a link to this file? It will download the ppt and open Powerpoint (or viewer) to display the presentation.
onwards and upwards...
|
|
|
|
|
|
on my first page i want to get a name and asign it to a variable:
exsample.....
please enter your name here .......
on submit we will go to next webpage
on the next page i want the name to be seen again,
exsample.....
this is where your name ...... could have apeared, if you would have filled it out on page one.
is there a way that java gets the name, assigns it to a variable
and than later use that variable to print the name again?
i have searched and searched tried many things but cant find it, i am totaly new to programming so if you know anything to help me out i will be thankfull
|
|
|
|
|
There's an example of this using cookies & JavaScript here on the JavaScript Source site.
|
|
|
|
|
Check out "PocketPrep" from handango.com.
It has 90 questions based on the test spec. (070-316 and 070-306)
|
|
|
|
|
A tip: get out your flameproof suit
Paul
I have been afraid always. When you see something insurmountable ahead of you, say to yourself: "All right! I am afraid. Now that I've been properly afraid, let's go forward." That is the whole secret. - Jeanne d'Arc
modified 18-Jul-18 11:59am.
|
|
|
|
|
Paul van der Walt wrote:
A tip: get out your flameproof suit
Some ppl just don't understand that "web dev" doesn't = arb test exams from MS that don't mean anything anyway.
Cheers,
Simon
"Don't try to be like Jackie. There is only one Jackie.... Study computers instead.", Jackie Chan on career choices.
animation mechanics in SVG (my first abstract photo)
|
|
|
|
|
hmmm....
Interesting....
Not a question or a suggestion....
Not an article proposal....
Not Web Developlment related....
hmmm.... what else?....
trying to advertise something here maybe.??....
Cmon CPians help me here....
Is this in anyway related to THIS SPECIFIC Message board?
Is there something that I didnt get?
WHICH PART OF
"Discussions on ASP / HTML/ DHTML / Javascript etc"
DIDNT HE UNDERSTAND ??...
...HMMM I REALLY WONDER!!...
|---------------|
| theJazzyBrain |
|---------------|
|
|
|
|
|
If use .
The problem is, I would like to know what the selection is BEFORE the drop down was dropped. anyone know if or how I can do this please?
Basically I would like ing="dosomething">.
I feel like I'm diagonally parked in a parallel universe
Jeremy Davis
http://www.astad.org http://www.jvf.co.uk
|
|
|
|
|
You can always create a property on the select to store the previous value and update it in your onchange handler. EX:
<script language=javascript><br />
<br />
function OnSelectChange() {<br />
var oElem = window.event.srcElement;<br />
var cOrigValue = oElem.LastValue;<br />
var cCurrValue = oElem.value;<br />
<br />
.. do whatever here...<br />
<br />
oElem.LastValue = cCurrValue;<br />
}<br />
<br />
</script><br />
<br />
<select name="MyDropdown" LastValue="" onchange="OnSelectChange()"><br />
<option value="red">Red</option><br />
<option value="white">White</option><br />
<option value="blue">Blue</option><br />
</select>
onwards and upwards...
|
|
|
|
|
|
Not sure about Netscape. We stopped developing for Netscape about 4 years ago. It is a HORRIBLE platform to develop real, functional business apps for.
onwards and upwards...
|
|
|
|
|
Hi
I have code where I position a dot on a map. I use a lot of style="position:absolute; left: numberpx; top: numberpx" code, but problem is it doesn't work in Netscape.
Where can I found comparisons of the two browsers especially for this type of problem
tx
|
|
|
|
|
Get used to it. Not much works correctly on Netscape.
onwards and upwards...
|
|
|
|
|
What version of Netscape?
A good list of many known bugs in the CSS implementations of different browsers can be found here:
http://www.richinstyle.com/[^]
Unfortunately, it only covers up to IE5.5 and NS6.
- Mike
|
|
|
|
|
We are going to be moving from one live web server, to 3 forming a web farm in the next month or so. We'll be using SQL and cookies to track sessions, and so far the examples I've looked at look great. However, one thing I'm not too sure of it the Verisign certificates. Obviously I have contacted them for more info, and it's looking very interesting, but I was wondering if anyone has experience of this, and if so, what advice (do's / don'ts ) you give?
Thanks
To honor you, and your sick games, this smiley will now represent licking chocolate off candy - David Chamberlain
|
|
|
|
|
I would, if you can ! get your own certificate server (Netscape).
You can request your certs from the MMC within IIS (if you are using IIS) and go to town
The cipher strength can be whatever 40bit, 128bit etc.
This will insure the protection of the packets being routed and the whole nine yards.
My employer considred VeriSign but decided it was too much of a hassle, not to mention the overhead.
Tony
|
|
|
|
|
Do you know of a good on-line tutorial on this subject. I have been planning on a SSL gatway on my web server but it is all new to me, have not done anything with SSL/HTTPS before.
Rocky Moore <><
|
|
|
|
|
|
Hi,
I was just wondering - have you set one of your machines up to be a certificate server then? I know this is possible using Win 2000, but then who is backing you up as it were, to prove you are who you say you are?
Thanks
Look at the world about you and trust to your own convictions. - Ansel Adams
|
|
|
|
|
Hi
I was asking you - but that post seems to be missing now
Look at the world about you and trust to your own convictions. - Ansel Adams
|
|
|
|