diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2012-06-06 08:58:27 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2012-06-06 08:58:27 +0000 |
commit | b61ba851da0157ace3bdfc1ebbf87156b0b76413 (patch) | |
tree | d6c567db57af1eb09c254a8bee13c305282334f8 /protocols/Quotes/ComHelper.cpp | |
parent | a4c70f6bedb25e5cffb08dfc5cbc2597d1642d6b (diff) |
protocols plugins moved to protocols
git-svn-id: http://svn.miranda-ng.org/main/trunk@327 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Quotes/ComHelper.cpp')
-rw-r--r-- | protocols/Quotes/ComHelper.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/protocols/Quotes/ComHelper.cpp b/protocols/Quotes/ComHelper.cpp new file mode 100644 index 0000000000..e15d05d739 --- /dev/null +++ b/protocols/Quotes/ComHelper.cpp @@ -0,0 +1,39 @@ +#include "StdAfx.h"
+#include "ComHelper.h"
+#include "Log.h"
+#include "WinCtrlHelper.h"
+
+tstring ComException2Msg(_com_error& e,const tstring& rsAdditionalInfo)
+{
+ HRESULT hError = e.Error();
+ tostringstream o;
+ if(false == rsAdditionalInfo.empty())
+ {
+ o << rsAdditionalInfo << "\n";
+ }
+
+ o << e.ErrorMessage() << _T(" (") << std::hex << hError << _T(")");
+
+ IErrorInfo* p = e.ErrorInfo();
+ CComPtr<IErrorInfo> pErrorInfo(p);
+ if(NULL != p)
+ {
+ p->Release();
+ }
+
+ if(pErrorInfo)
+ {
+ o << _T("\n") << e.Description();
+ }
+
+ return o.str();
+}
+
+void ShowComError(_com_error& e,const tstring& rsAdditionalInfo)
+{
+ tstring sErrorMsg = ComException2Msg(e,rsAdditionalInfo);
+ LogIt(Error,sErrorMsg);
+ Quotes_MessageBox(NULL,sErrorMsg.c_str(),MB_OK|MB_ICONERROR);
+}
+
+
|