コード例 #1
0
bool IEView::mouseClick(POINT pt) {
    bool result = false;
    if (GetFocus() != hwnd) {
		getFocus = true;
	}
	IHTMLDocument2 *document = getDocument();
	if (document != NULL) {
        IHTMLElement *element;
  		if (SUCCEEDED(document->elementFromPoint( pt.x, pt.y, &element ))&& element!=NULL) {
//		IHTMLAnchorElement * pAnchor;
//			if (SUCCEEDED(element->QueryInterface(IID_IHTMLAnchorElement, (void**)&pAnchor)) && (pAnchor!=NULL)) {
//				element->click();
//				result = true;
//				pAnchor->Release();
//			}
  			BSTR url = getHrefFromAnchor(element);
  			if (url != NULL) {
				if ((GetKeyState(VK_SHIFT) & 0x8000) && !(GetKeyState(VK_CONTROL) & 0x8000)
				&& !(GetKeyState(VK_MENU) & 0x8000)) {
					SendMessage(GetParent(hwnd), WM_COMMAND, IDCANCEL, 0);
				}
  			    int i = wcslen(url);
  			    char *tTemp = new char[i+1];
  			    WideCharToMultiByte(CP_ACP, 0, url, -1, tTemp, i+1, NULL, NULL);
		    	CallService(MS_UTILS_OPENURL, (WPARAM) 1, (LPARAM) tTemp);
                delete tTemp;
                delete url;
                result = true;
  			}
  			element->Release();
  		}
	    document->Release();
	}
	return result;
}
コード例 #2
0
bool IEView::mouseClick(POINT pt) {
    bool result = false;
    if (GetFocus() != hwnd) {
		getFocus = true;
	}
	IHTMLDocument2 *document = getDocument();
	if (document != NULL) {
        IHTMLElement *element;
  		if (SUCCEEDED(document->elementFromPoint( pt.x, pt.y, &element ))&& element!=NULL) {
  			BSTR url = getHrefFromAnchor(element);
  			if (url != NULL) {
  			    int i = wcslen(url);
  			    char *tTemp = new char[i+1];
  			    WideCharToMultiByte(CP_ACP, 0, url, -1, tTemp, i+1, NULL, NULL);
		    	CallService(MS_UTILS_OPENURL, (WPARAM) 1, (LPARAM) tTemp);
                delete tTemp;
                free (url);
                result = true;
  			}
  			element->Release();
  		}
	    document->Release();
	}
	return result;
}
コード例 #3
0
ファイル: IEView.cpp プロジェクト: slotwin/miranda-ng
bool IEView::mouseClick(POINT pt) {
	bool result = false;
	if (GetFocus() != hwnd) {
		getFocus = true;
	}
	IHTMLDocument2 *document = getDocument();
	if (document != NULL) {
		IHTMLElement *element;
		if (SUCCEEDED(document->elementFromPoint( pt.x, pt.y, &element ))&& element!=NULL) {
//		IHTMLAnchorElement * pAnchor;
//			if (SUCCEEDED(element->QueryInterface(IID_IHTMLAnchorElement, (void**)&pAnchor)) && (pAnchor!=NULL)) {
//				element->click();
//				result = true;
//				pAnchor->Release();
//			}
			BSTR url = getHrefFromAnchor(element);
			if (url != NULL) {
				if ((GetKeyState(VK_SHIFT) & 0x8000) && !(GetKeyState(VK_CONTROL) & 0x8000)
				&& !(GetKeyState(VK_MENU) & 0x8000)) {
					SendMessage(GetParent(hwnd), WM_COMMAND, IDCANCEL, 0);
				}
				CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW|OUF_TCHAR, (LPARAM) url);
				mir_free(url);
				result = true;
			}
			element->Release();
		}
		document->Release();
	}
	return result;
}