ChtmlView reads a function of a web page with a frame.

xiaoxiao2021-03-31  223

Bool getFramesource (CString & Refstring, long frameIndex = 0)

FrameIndex is the serial number of the frame set

0 Represents the main frame, return FALSE if FrameIndex is greater than the total frame number

BOOL CHtmlView :: GetFrameSource (CString & refString, long frameIndex) {BOOL bRetVal = FALSE; if (frameIndex == 0) {bRetVal = GetSource (refString);} else if (frameIndex> 0) {frameIndex = frameIndex - 1; CComQIPtr < Idispatch> pdisp = gethtmlDocument ();

IF (pdisp! = null) {ccomqiptr phtmldoc = PDISP;

IF (phtmldoc! = null) {ccomqiptr pframes; phtmldoc-> get_frames (& pframes);

IF (pframes! = null) {long framecount = 0; pframes-> get_length; & framecount;

IF (framecount> frameindex) {Colevariant Varindex (FrameIntex, VT_i4); Colevariant Varpdisp; Pframes-> Item (VarIndex, Varpdisp); ccomqiptr pdispdoc = varpdisp.pdispval;

IF (pdispdoc! = null) {ccomqiptr phtmlwnd = pdispdoc;

IF (phtmlwnd! = null) {ccomqiptr phtmldocf; phtmlwnd-> get_document (& phtmldocf);

IF (phtmldocf! = null) {hglobal hmemory; hmemory = GlobalAlloc (GMEM_MOVEABLE, 0);

IF (hmemory! = null) {ccomqiptr sppsi = phtmldocf;

if (spPSI = NULL!) {CComPtr spStream; if (SUCCEEDED (CreateStreamOnHGlobal (hMemory, TRUE, & spStream))) {spPSI-> Save (spStream, FALSE); LPCTSTR pstr = (LPCTSTR) GlobalLock (hMemory); if (pstr = NULL!) {bRetVal = TRUE; TRY {refString = pstr;} CATCH_ALL (e) {bRetVal = FALSE; DELETE_EXCEPTION (e);} END_CATCH_ALLif (bRetVal == FALSE) GlobalFree (hMemory); else GlobalUnlock (hMemory )}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}

Return Bretval;}

转载请注明原文地址:https://www.9cbs.com/read-130998.html

New Post(0)