00001 #include "StdAfx.h"
00002
00003 #include "Comdef.h"
00004
00005 extern const wchar_t* g_COCLASS_PROGIDW;
00006
00007 void SetErrorInfo(HRESULT hr, const wchar_t* err)
00008 {
00009 ICreateErrorInfoPtr errCreate;
00010 if (SUCCEEDED(CreateErrorInfo(&errCreate))
00011 && SUCCEEDED(errCreate->SetDescription(const_cast<wchar_t*>(err)))
00012 && SUCCEEDED(errCreate->SetSource(const_cast<wchar_t*>(g_COCLASS_PROGIDW)))
00013 )
00014 {
00015 IErrorInfoPtr errorInfo = errCreate;
00016 SetErrorInfo(0, errorInfo);
00017 }
00018 }