-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMyScriptSite.h
42 lines (37 loc) · 1011 Bytes
/
CMyScriptSite.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#pragma once
#include "No5IrcObj.h"
void GetScriptEngines(CSimpleArray<CString>& vv);
class ATL_NO_VTABLE CMyScriptSite :
public CComObjectRootEx<CComSingleThreadModel>,
public CScriptSiteImpl
{
CComQIPtr<INo5IrcObj> m_spNo5;
public:
CMyScriptSite()
{
}
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(CMyScriptSite)
COM_INTERFACE_ENTRY(IActiveScriptSite)
COM_INTERFACE_ENTRY(IActiveScriptSiteWindow)
END_COM_MAP()
HRESULT Init(CComPtr<IDispatch> spNo5,LPCTSTR lang) {
m_spNo5 = spNo5;
HRESULT hr = Initiate(lang, GetDesktopWindow());
if (SUCCEEDED(hr)) {
hr = AddObject(_T("no5"), TRUE, TRUE);
}
ATLASSERT(SUCCEEDED(hr));
return hr;
}
STDMETHOD(LookupNamedItem)(LPCOLESTR pstrName, LPUNKNOWN* ppunkItem)
{
CComBSTR name = pstrName;
HRESULT hr = TYPE_E_ELEMENTNOTFOUND;
if (name == OLESTR("no5")) {
ATLASSERT(ppunkItem != NULL);
hr = m_spNo5->QueryInterface(IID_INo5IrcObj,(void **) ppunkItem);
}
return hr;
}
};