summaryrefslogtreecommitdiff
path: root/plugins/IEView/src
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2016-01-22 14:10:15 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2016-01-22 14:10:15 +0000
commitd0d4495f1117682d2cee660f45fa422953487abf (patch)
tree94a78df60f1eb6f293ef6752c6e9fc8bff0a5065 /plugins/IEView/src
parent3a09ce8ad3e0aa8bb97266def2f38e1295392d2d (diff)
IEView: more external functions
git-svn-id: http://svn.miranda-ng.org/main/trunk@16143 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/IEView/src')
-rw-r--r--plugins/IEView/src/IEView.cpp15
-rw-r--r--plugins/IEView/src/IEView.h5
-rw-r--r--plugins/IEView/src/external_funcs.cpp59
-rw-r--r--plugins/IEView/src/external_funcs.h12
-rw-r--r--plugins/IEView/src/ieview_services.cpp4
5 files changed, 89 insertions, 6 deletions
diff --git a/plugins/IEView/src/IEView.cpp b/plugins/IEView/src/IEView.cpp
index 1ae29850a9..c09544c6f7 100644
--- a/plugins/IEView/src/IEView.cpp
+++ b/plugins/IEView/src/IEView.cpp
@@ -430,10 +430,18 @@ STDMETHODIMP IEView::GetIDsOfNames(REFIID /*riid*/, LPOLESTR *rgszNames, UINT cN
rgDispId[i] = DISPID_EXTERNAL_DB_GET;
else if (!wcscmp(L"db_set", rgszNames[i]))
rgDispId[i] = DISPID_EXTERNAL_DB_SET;
+
else if (!wcscmp(L"win32_ShellExecute", rgszNames[i]))
rgDispId[i] = DISPID_EXTERNAL_WIN32_SHELL_EXECUTE;
+
else if (!wcscmp(L"IEView_SetContextMenuHandler", rgszNames[i]))
rgDispId[i] = DISPID_EXTERNAL_SET_CONTEXTMENUHANDLER;
+ else if (!wcscmp(L"IEView_GetCurrentContact", rgszNames[i]))
+ rgDispId[i] = DISPID_EXTERNAL_GET_CURRENTCONTACT;
+
+ else if (!wcscmp(L"mir_CallService", rgszNames[i]))
+ rgDispId[i] = DISPID_EXTERNAL_CALLSERVICE;
+
else
{
rgDispId[i] = NULL;
@@ -455,12 +463,19 @@ STDMETHODIMP IEView::Invoke(DISPID dispIdMember,
switch (dispIdMember)
{
+ case DISPID_EXTERNAL_CALLSERVICE:
+ return External::mir_CallService(pDispParams, pVarResult);
+
case DISPID_EXTERNAL_DB_GET:
return External::db_get(pDispParams, pVarResult);
case DISPID_EXTERNAL_DB_SET:
return External::db_set(pDispParams, pVarResult);
+
case DISPID_EXTERNAL_WIN32_SHELL_EXECUTE:
return External::win32_ShellExecute(pDispParams, pVarResult);
+
+ case DISPID_EXTERNAL_GET_CURRENTCONTACT:
+ return External::IEView_GetCurrentContact(this, pDispParams, pVarResult);
case DISPID_EXTERNAL_SET_CONTEXTMENUHANDLER:
return External::IEView_SetContextMenuHandler(this, pDispParams, pVarResult);
}
diff --git a/plugins/IEView/src/IEView.h b/plugins/IEView/src/IEView.h
index 0f6e32c71c..f43d26b3aa 100644
--- a/plugins/IEView/src/IEView.h
+++ b/plugins/IEView/src/IEView.h
@@ -566,5 +566,10 @@ public:
replaceStrW(wszContextMenuHandler, handler);
}
+ inline MCONTACT Get_CurrentContact()
+ {
+ return hContact;
+ }
+
};
#endif
diff --git a/plugins/IEView/src/external_funcs.cpp b/plugins/IEView/src/external_funcs.cpp
index 9eb72c5db0..3032cda757 100644
--- a/plugins/IEView/src/external_funcs.cpp
+++ b/plugins/IEView/src/external_funcs.cpp
@@ -3,14 +3,67 @@
namespace External
{
+ HRESULT mir_CallService(DISPPARAMS *pDispParams, VARIANT *pVarResult)
+ {
+ if (pDispParams == nullptr || pDispParams->cArgs < 3)
+ return E_INVALIDARG;
+
+ BSTR szName = pDispParams->rgvarg[2].bstrVal;
+ WPARAM wParam = 0;
+ LPARAM lParam = 0;
+
+ switch (pDispParams->rgvarg[1].vt)
+ {
+ case VT_BSTR:
+ wParam = (WPARAM)pDispParams->rgvarg[1].bstrVal;
+ case VT_INT:
+ case VT_I1:
+ case VT_I2:
+ case VT_I4:
+ case VT_I8:
+ wParam = (WPARAM)pDispParams->rgvarg[1].intVal;
+ }
+
+ switch (pDispParams->rgvarg[0].vt)
+ {
+ case VT_BSTR:
+ lParam = (LPARAM)pDispParams->rgvarg[0].bstrVal;
+ case VT_INT:
+ case VT_I1:
+ case VT_I2:
+ case VT_I4:
+ case VT_I8:
+ lParam = (LPARAM)pDispParams->rgvarg[0].intVal;
+ }
+
+ INT_PTR res = CallService(_T2A((TCHAR*)szName), wParam, lParam);
+
+ if (pVarResult != nullptr)
+ {
+ pVarResult->vt = VT_INT_PTR;
+ pVarResult->ullVal = (ULONGLONG)res;
+ }
+ return S_OK;
+ }
+
HRESULT IEView_SetContextMenuHandler(IEView *self, DISPPARAMS *pDispParams, VARIANT *pVarResult)
{
- if (pDispParams->cArgs < 1 || pDispParams == nullptr)
+ if (pDispParams == nullptr || pDispParams->cArgs < 1)
return E_INVALIDARG;
self->Set_ContextMenuHandler(mir_wstrdup(pDispParams->rgvarg[0].bstrVal));
return S_OK;
}
+ HRESULT IEView_GetCurrentContact(IEView *self, DISPPARAMS *pDispParams, VARIANT *pVarResult)
+ {
+ if (pVarResult != nullptr)
+ {
+ pVarResult->vt = VT_UINT;
+ pVarResult->uintVal = self->Get_CurrentContact();
+ }
+ return S_OK;
+ }
+
HRESULT db_get(DISPPARAMS *pDispParams, VARIANT *pVarResult)
{
if (pDispParams->cArgs < 3)
@@ -61,7 +114,7 @@ namespace External
HRESULT db_set(DISPPARAMS *pDispParams, VARIANT *pVarResult)
{
- if (pDispParams->cArgs < 4 || pDispParams == nullptr)
+ if (pDispParams == nullptr || pDispParams->cArgs < 4)
return E_INVALIDARG;
MCONTACT hContact = pDispParams->rgvarg[3].intVal;
@@ -106,7 +159,7 @@ namespace External
HRESULT win32_ShellExecute(DISPPARAMS *pDispParams, VARIANT *pVarResult)
{
- if (pDispParams->cArgs < 5 || pDispParams == nullptr)
+ if (pDispParams == nullptr || pDispParams->cArgs < 5)
return E_INVALIDARG;
HINSTANCE res = ShellExecuteW(NULL, pDispParams->rgvarg[4].bstrVal, pDispParams->rgvarg[3].bstrVal, pDispParams->rgvarg[2].bstrVal, pDispParams->rgvarg[1].bstrVal, pDispParams->rgvarg[0].intVal);
diff --git a/plugins/IEView/src/external_funcs.h b/plugins/IEView/src/external_funcs.h
index c107f49b21..a25f497016 100644
--- a/plugins/IEView/src/external_funcs.h
+++ b/plugins/IEView/src/external_funcs.h
@@ -1,15 +1,25 @@
enum EXTERNAL_FUNCTIONS
{
+ DISPID_EXTERNAL_CALLSERVICE = 600,
+
DISPID_EXTERNAL_SET_CONTEXTMENUHANDLER = 630,
+ DISPID_EXTERNAL_GET_CURRENTCONTACT,
+
DISPID_EXTERNAL_DB_GET = 652,
DISPID_EXTERNAL_DB_SET,
- DISPID_EXTERNAL_WIN32_SHELL_EXECUTE
+
+ DISPID_EXTERNAL_WIN32_SHELL_EXECUTE = 660
};
namespace External
{
+ HRESULT mir_CallService(DISPPARAMS *pDispParams, VARIANT *pVarResult);
+
HRESULT IEView_SetContextMenuHandler(IEView *self, DISPPARAMS *pDispParams, VARIANT *pVarResult);
+ HRESULT IEView_GetCurrentContact(IEView *self, DISPPARAMS *pDispParams, VARIANT *pVarResult);
+
HRESULT db_get(DISPPARAMS *pDispParams, VARIANT *pVarResult);
HRESULT db_set(DISPPARAMS *pDispParams, VARIANT *pVarResult);
+
HRESULT win32_ShellExecute(DISPPARAMS *pDispParams, VARIANT *pVarResult);
} \ No newline at end of file
diff --git a/plugins/IEView/src/ieview_services.cpp b/plugins/IEView/src/ieview_services.cpp
index 2b7fc6f8a6..b1d6d66f27 100644
--- a/plugins/IEView/src/ieview_services.cpp
+++ b/plugins/IEView/src/ieview_services.cpp
@@ -87,6 +87,8 @@ INT_PTR HandleIEEvent(WPARAM, LPARAM lParam)
view->saveDocument();
else if (event->iType == IEE_LOG_MEM_EVENTS)
view->appendEvent(event);
+
+ view->setContact(event->hContact);
}
return 0;
}
@@ -104,8 +106,6 @@ INT_PTR HandleIENavigate(WPARAM, LPARAM lParam)
return 0;
}
-void ApplyChanges(int i);
-
INT_PTR ReloadOptions(WPARAM, LPARAM)
{
Options::Reload();