コード例 #1
1
void IEView::scrollToBottom() {
    /*
    	IHTMLDocument2 *document = getDocument();
    	if (document != NULL) {
    		wchar_t *p = NULL;
    		if (SUCCEEDED(document->get_readyState(&p))) {
    		    int licznik = 0;
        		do {
              		if (FAILED(document->get_readyState(&p))) {
              		    break;
                    }
                    licznik++;
                    if (licznik == 1) break;
                    Sleep(10);
        		} while (!wcscmp(p, L"loading"));
    		}
    		IHTMLWindow2* pWindow = NULL;
    		if (SUCCEEDED(document->get_parentWindow( &pWindow )) && pWindow != NULL) {
    			pWindow->scrollBy( 0, 0x01FFFFFF );
    		}
    		document->Release();
    	}*/

    IHTMLDocument2 *document = getDocument();
    if (document != NULL) {
        IHTMLElementCollection *collection;
        IHTMLElement *element;
        IDispatch *dispatch;
        if (SUCCEEDED(document->get_all(&collection)) && (collection != NULL)) {
            long len;
            if (SUCCEEDED(collection->get_length(&len))) {
                VARIANT	variant;
                variant.vt = VT_I4;
                variant.lVal = len-1;
                if (SUCCEEDED(collection->item(variant, variant, &dispatch)) && (dispatch != NULL)) {
                    if (SUCCEEDED(dispatch->QueryInterface(IID_IHTMLElement,(void**)&element)) && (element != NULL)) {
                        variant.vt = VT_BOOL;
                        variant.boolVal = VARIANT_FALSE;
                        if (SUCCEEDED(element->scrollIntoView(variant))) {
                        }
                        element->Release();
                    }
                    dispatch->Release();
                }
            }
            collection->Release();
        }
        IHTMLWindow2* pWindow = NULL;
        if (SUCCEEDED(document->get_parentWindow( &pWindow )) && (pWindow != NULL)) {
            pWindow->scrollBy( -0x01FFFFFF, 0x01FFFFFF );
            pWindow->Release();
        }
        document->Release();
    }
}
コード例 #2
0
void IEView::scrollToBottomSoft() {
	IHTMLDocument2 *document = getDocument();
	if (document != NULL) {
		IHTMLWindow2* pWindow = NULL;
		if (SUCCEEDED(document->get_parentWindow( &pWindow )) && (pWindow != NULL)) {
			pWindow->scrollBy( -0x01FFFFFF, 0x01FFFFFF );
			pWindow->Release();
		}
		document->Release();
	}
}