예제 #1
0
// here's a helper function for displaying useful error messages
BOOL ProcessHResult(HRESULT hr, IUnknown* p, const IID& iid)
{
	if( hr == S_OK )
		return true;

	// otherwise, throw a _com_issue_errorex and catch it (so we can use it to get
	//  the error description out of it for us.
	try
	{
		_com_issue_errorex(hr, p, iid);
	}
	catch(_com_error & er)
	{
		if( er.Description().length() > 0)
		{
			::MessageBox(NULL, er.Description(), strCaption, MB_OK);
		}
		else
		{
			::MessageBox(NULL, er.ErrorMessage(), strCaption, MB_OK);
		}
	}

	return false;
}
예제 #2
0
inline _variant_t IScriptControl::Run ( _bstr_t ProcedureName, SAFEARRAY * * Parameters ) {
    VARIANT _result;
    VariantInit(&_result);
    HRESULT _hr = raw_Run(ProcedureName, Parameters, &_result);
    if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
    return _variant_t(_result, false);
}
예제 #3
0
inline _variant_t IScriptModule::Eval ( _bstr_t Expression ) {
    VARIANT _result;
    VariantInit(&_result);
    HRESULT _hr = raw_Eval(Expression, &_result);
    if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
    return _variant_t(_result, false);
}
예제 #4
0
void CJSOpenView::OnFileWindowOpen() {
	HRESULT hr;
	CString str;
	try {
		CComQIPtr<IHTMLDocument2> document = GetHtmlDocument();
		if (document != NULL) {
			IHTMLWindow2Ptr window;
			document->get_parentWindow(&window);
			if (window != NULL) {
				CComBSTR url;
				document->get_URL(&url);

				CComPtr<IHTMLWindow2> newwin;
				if (FAILED(hr = window->open(url, CComBSTR(L"_blank"), CComBSTR(), false, &newwin))) {
					_com_issue_errorex(hr, window, IID_IHTMLWindow2);
				}
				printf("");
			}
		}
	}
	catch (_com_error err) {
		AfxMessageBox(CString(err.ErrorMessage()), MB_ICONEXCLAMATION);
	}
}
예제 #5
0
inline IScriptProcedureCollectionPtr IScriptModule::GetProcedures ( ) {
    struct IScriptProcedureCollection * _result;
    HRESULT _hr = get_Procedures(&_result);
    if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
    return IScriptProcedureCollectionPtr(_result, false);
}
예제 #6
0
inline _bstr_t IScriptModule::GetName ( ) {
    BSTR _result;
    HRESULT _hr = get_Name(&_result);
    if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
    return _bstr_t(_result, false);
}
예제 #7
0
inline IScriptProcedurePtr IScriptProcedureCollection::GetItem ( const _variant_t & Index ) {
    struct IScriptProcedure * _result;
    HRESULT _hr = get_Item(Index, &_result);
    if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
    return IScriptProcedurePtr(_result, false);
}
예제 #8
0
inline HRESULT IScriptControl::AddObject ( _bstr_t Name, IDispatch * Object, VARIANT_BOOL AddMembers ) {
    HRESULT _hr = raw_AddObject(Name, Object, AddMembers);
    if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
    return _hr;
}
예제 #9
0
inline enum ScriptControlStates IScriptControl::GetState ( ) {
    enum ScriptControlStates _result;
    HRESULT _hr = get_State(&_result);
    if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
    return _result;
}
예제 #10
0
inline void IScriptControl::PutLanguage ( _bstr_t pbstrLanguage ) {
    HRESULT _hr = put_Language(pbstrLanguage);
    if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
}
예제 #11
0
inline _bstr_t IScriptControl::GetLanguage ( ) {
    BSTR _result;
    HRESULT _hr = get_Language(&_result);
    if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
    return _bstr_t(_result, false);
}
예제 #12
0
inline HRESULT IScriptError::Clear ( ) {
    HRESULT _hr = raw_Clear();
    if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
    return _hr;
}
예제 #13
0
inline long IScriptProcedure::GetNumArgs ( ) {
    long _result;
    HRESULT _hr = get_NumArgs(&_result);
    if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
    return _result;
}
예제 #14
0
inline long IScriptError::GetColumn ( ) {
    long _result;
    HRESULT _hr = get_Column(&_result);
    if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
    return _result;
}
예제 #15
0
inline _bstr_t IScriptError::GetDescription ( ) {
    BSTR _result;
    HRESULT _hr = get_Description(&_result);
    if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
    return _bstr_t(_result, false);
}
예제 #16
0
inline void IScriptControl::PutUseSafeSubset ( VARIANT_BOOL pfUseSafeSubset ) {
    HRESULT _hr = put_UseSafeSubset(pfUseSafeSubset);
    if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
}
예제 #17
0
inline IScriptErrorPtr IScriptControl::GetError ( ) {
    struct IScriptError * _result;
    HRESULT _hr = get_Error(&_result);
    if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
    return IScriptErrorPtr(_result, false);
}
예제 #18
0
inline void IScriptControl::PutState ( enum ScriptControlStates pssState ) {
    HRESULT _hr = put_State(pssState);
    if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
}
예제 #19
0
inline HRESULT IScriptControl::Reset ( ) {
    HRESULT _hr = raw_Reset();
    if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
    return _hr;
}
예제 #20
0
inline void IScriptControl::PutSitehWnd ( long phwnd ) {
    HRESULT _hr = put_SitehWnd(phwnd);
    if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
}
예제 #21
0
inline IUnknownPtr IScriptProcedureCollection::Get_NewEnum ( ) {
    IUnknown * _result;
    HRESULT _hr = get__NewEnum(&_result);
    if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
    return IUnknownPtr(_result, false);
}
예제 #22
0
inline long IScriptControl::GetTimeout ( ) {
    long _result;
    HRESULT _hr = get_Timeout(&_result);
    if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
    return _result;
}
예제 #23
0
inline long IScriptProcedureCollection::GetCount ( ) {
    long _result;
    HRESULT _hr = get_Count(&_result);
    if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
    return _result;
}
예제 #24
0
inline void IScriptControl::PutTimeout ( long plMilleseconds ) {
    HRESULT _hr = put_Timeout(plMilleseconds);
    if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
}
예제 #25
0
inline IDispatchPtr IScriptModule::GetCodeObject ( ) {
    IDispatch * _result;
    HRESULT _hr = get_CodeObject(&_result);
    if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
    return IDispatchPtr(_result, false);
}
예제 #26
0
inline void IScriptControl::PutAllowUI ( VARIANT_BOOL pfAllowUI ) {
    HRESULT _hr = put_AllowUI(pfAllowUI);
    if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
}
예제 #27
0
inline HRESULT IScriptModule::AddCode ( _bstr_t Code ) {
    HRESULT _hr = raw_AddCode(Code);
    if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
    return _hr;
}
예제 #28
0
inline VARIANT_BOOL IScriptProcedure::GetHasReturnValue ( ) {
    VARIANT_BOOL _result;
    HRESULT _hr = get_HasReturnValue(&_result);
    if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
    return _result;
}
예제 #29
0
inline HRESULT IScriptModule::ExecuteStatement ( _bstr_t Statement ) {
    HRESULT _hr = raw_ExecuteStatement(Statement);
    if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
    return _hr;
}
예제 #30
0
inline VARIANT_BOOL IScriptControl::GetUseSafeSubset ( ) {
    VARIANT_BOOL _result;
    HRESULT _hr = get_UseSafeSubset(&_result);
    if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
    return _result;
}