]> git.sesse.net Git - vlc/blob - projects/activex/supporterrorinfo.cpp
Replace libvlc_exception_get_message with libvlc_errmsg
[vlc] / projects / activex / supporterrorinfo.cpp
1 /*****************************************************************************
2  * supporterrorinfo.cpp: ActiveX control for VLC
3  *****************************************************************************
4  * Copyright (C) 2005 the VideoLAN team
5  *
6  * Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
21  *****************************************************************************/
22
23 #include "plugin.h"
24 #include "supporterrorinfo.h"
25
26 #include "utils.h"
27 #include "axvlc_idl.h"
28
29 using namespace std;
30
31 STDMETHODIMP VLCSupportErrorInfo::InterfaceSupportsErrorInfo(REFIID  riid)
32 {
33     if( (riid == IID_IVLCAudio)
34      || (riid == IID_IVLCInput)
35      || (riid == IID_IVLCLog)
36      || (riid == IID_IVLCMarquee)
37      || (riid == IID_IVLCMessage)
38      || (riid == IID_IVLCMessageIterator)
39      || (riid == IID_IVLCMessages)
40      || (riid == IID_IVLCPlaylist)
41      || (riid == IID_IVLCPlaylistItems)
42      || (riid == IID_IVLCSubtitle)
43      || (riid == IID_IVLCVideo)
44      || (riid == IID_IVLCControl2) )
45     {
46         return S_OK;
47     }
48     return S_FALSE;
49 };
50
51 void VLCSupportErrorInfo::setErrorInfo(LPCOLESTR progid, REFIID riid, const char *description)
52 {
53     BSTR bstrDescription = BSTRFromCStr(CP_UTF8, description);
54     if( NULL != bstrDescription )
55     {
56         ICreateErrorInfo* pcerrinfo;
57
58         HRESULT hr = CreateErrorInfo(&pcerrinfo);
59         if( SUCCEEDED(hr) )
60         {
61             IErrorInfo* perrinfo;
62
63             pcerrinfo->SetSource((LPOLESTR)progid);
64             pcerrinfo->SetGUID(riid);
65             pcerrinfo->SetDescription((LPOLESTR)bstrDescription);
66             hr = pcerrinfo->QueryInterface(IID_IErrorInfo, (LPVOID*) &perrinfo);
67             if( SUCCEEDED(hr) )
68             {
69                ::SetErrorInfo(0, perrinfo);
70                perrinfo->Release();
71             }
72             pcerrinfo->Release();
73         }
74         SysFreeString(bstrDescription);
75     }
76 };
77