[url=http://www.cheapairmax90forsale.com/#shoes113]Buy Air Max 95 Red Black[/url] will have dramatically improved wearing these, [url=http://www.cllouboutinshoes.com/#redd36]Shop Christian Louboutin Jenny Silver[/url] The Free Run shoes are awesome, offer proper cushioning to help absorb shock, [url=http://www.freerun001.com/#nikefree244]Cheap Nike Free Run 3 Men Blue/Yellow/Black Shoes[/url] offers great feel and proprioception.
ReplyHi Asher, In typical Micorosft fashion, the big picture is missed due. I have not been able to locate quality samples (any samples for that matter) near IMarkupContainer. Do you have a larger nugget? I'm very interested in IHTMLElement (see http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/mshtml/reference/ifaces/ihtmlelement/element.asp) Jeff
ReplyThank you very much for this great example -- it saved me so much time!!!
ReplyOriginally posted by: David Rigby
I'm having problems using IHTMLDOMNode in my project. All references to this interface produce 'use of undefined type' errors, even though looking in the TLH/TLI generated form the import of MSHTML the definition of the interface is there. I can use other interfaces defined in MSHTML (and appearing in the TLH in an identical way) but it seems that none of the HTMLDOMxxx ones are usable (IHTMLDOMAttribute also produces the same error). I'm sure this is something simple but I really can't see it! Any clues appreciated.
Thanks
David
ReplyOriginally posted by: Joe James
const
procedure TFormMain.FormCreate(Sender: TObject);
( add to uses clause, MSHTML, ActiveX, ComObj )
IID_IPersistStreamInit : TGUID = '{7FD52380-4E07-101B-AE2D-08002B2EC713}';
var
pDoc : IHTMLDocument2;
pNewDoc : IHTMLDocument2;
pPersist : IPersistStreamInit;
pMS : IMarkupServices;
pMC : IMarkupContainer;
pMkStart : IMarkupPointer;
pMkFinish : IMarkupPointer;
pBody : IHTMLElement;
strText : string;
szHTML : widestring;
didInit : boolean;
begin
didInit :=Succeeded(CoInitialize(nil));
szHTML :='<HTML><BODY>Hello World!</BODY></HTML>';
CoCreateInstance(CLASS_HTMLDocument, nil, CLSCTX_INPROC_SERVER, IID_IHTMLDocument2, pDoc);
if pDoc <> nil then
begin
pDoc.QueryInterface(IID_IPersistStreamInit, pPersist);
if (pPersist <> nil) then
begin
pPersist.InitNew;
pPersist._Release;
pDoc.QueryInterface(IID_IMarkupServices, pMS);
if (pMS <> nil) then
begin
pMS.CreateMarkupPointer(pMkStart);
pMS.CreateMarkupPointer(pMkFinish);
pMS.ParseString(word(szHTML[1]), 0, pMC, pMkStart, pMkFinish);
if (pMC <> nil) then
begin
pMC.QueryInterface(IID_IHTMLDocument, pNewDoc);
if (pNewDoc <> nil) then
begin
// do anything with pNewDoc, in this case
// get the body innerText.
pBody :=pNewDoc.Get_body;
if (pBody <> nil) then
begin
strText :=pBody.Get_innerText;
m.Text :=strText;
pBody._Release;
end;
pNewDoc._Release;
end;
pMC._Release;
end;
if (pMkStart <> nil) then pMkStart._Release;
if (pMkFinish <> nil) then pMkFinish._Release;
pMS._Release;
end;
pPersist._Release;
end;
pDoc._Release;
end;
if didInit then CoUninitialize();
end;
Originally posted by: Joe James
const
procedure TFormMain.FormCreate(Sender: TObject);
============== Other Useful Routines ===============
procedure SetHTMLSource(Document: IDispatch; value: string);
( add to uses clause, MSHTML, ActiveX, ComObj )
IID_IPersistStreamInit : TGUID = '{7FD52380-4E07-101B-AE2D-08002B2EC713}';
var
pDoc : IHTMLDocument2;
pBody : IHTMLElement;
strText : string;
szHTML : widestring;
didInit : boolean;
begin
didInit :=Succeeded(CoInitialize(nil));
szHTML :='<HTML><BODY>Hello World!</BODY></HTML>';
CoCreateInstance(CLASS_HTMLDocument, nil, CLSCTX_INPROC_SERVER, IID_IHTMLDocument2, pDoc);
if pDoc <> nil then
begin
pDoc.Set_designMode('On'); //no script execution
while not (pDoc.readyState = 'complete') do Application.ProcessMessages;
pDoc.body.innerHTML :=szHTML;
pBody :=pDoc.Get_body;
if pBody <> nil then
strText :=pBody.Get_innerText else strText :='';
m.Text :=strText;
pDoc._Release;
end;
if didInit then CoUninitialize();
end;
============== Other Useful Routines ===============
============== Other Useful Routines ===============
function GetHTMLSource(Document: IDispatch) : string;
var
pStream : IStream;
pPersist : IPersistStreamInit;
li,lo : int64;
stat : STATSTG;
str : string;
BytesRead : longint;
begin
result :='';
if SUCCEEDED(CreateStreamOnHGlobal(0, TRUE, pStream)) then
begin
if (SUCCEEDED(Document.QueryInterface(IID_IPersistStreamInit, pPersist))) then
begin
pPersist.Save(pStream, FALSE);
li :=0;
pStream.Seek(li, STREAM_SEEK_SET, lo);
pStream.Stat(stat, 0);
SetLength(str,stat.cbSize + 1);
pStream.Read(@str[1], stat.cbSize, @BytesRead);
result :=str;
end;
end;
end;
var
stm : TMemoryStream;
psi : IPersistStreamInit;
sa : TStreamAdapter;
begin
stm :=TMemoryStream.Create;
stm.SetSize(Length(value));
stm.Seek(0,0);
stm.Write(value[1],Length(value));
stm.Seek(0,0);
sa :=TStreamAdapter.Create(stm, soReference); //if you pass soOwned instead, the stream will be freed for you
if (SUCCEEDED(Document.QueryInterface(IID_IPersistStreamInit,psi))) then
psi.Load(sa);
end;
Originally posted by: Peter
The $ character seems to be used to indicate that the item is a template.
ReplyOriginally posted by: genie
I create ParseHTML.cpp file after this site copy source.
result is "LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main"
what is wrong?
Originally posted by: Simon
When I created IMarkupContainer using ParseString the <BODY> element magically lost all it's attributes.
Now I'm using open, write and cloes methods, to write in IHTMLDocument2 first and it works.
ReplyOriginally posted by: Simon
When I query IHTMLDocument2 to get IMarkupInterfaces I get the 0x80004002 error result. Any clues what am I doing wrong. I'm using the same code as the sample above in VC++ 6.0 with Platform and IE6 SDK. I'm developing COM server (in multithreaded apartment).
Thanks for any clues in advance.
Reply