diff options
author | MikalaiR <nikolay.romanovich@narod.ru> | 2016-01-21 13:24:38 +0000 |
---|---|---|
committer | MikalaiR <nikolay.romanovich@narod.ru> | 2016-01-21 13:24:38 +0000 |
commit | db58ffd66b837aa184ee8d934811b78f9ff8040b (patch) | |
tree | 74ef8573574fdf89d684d1d0bc4a3cc33a0076b4 /plugins/IEView | |
parent | e39a0d8ea79a50de094811ce9adf110252aa7f31 (diff) |
IEView: external db_set function
git-svn-id: http://svn.miranda-ng.org/main/trunk@16135 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/IEView')
-rw-r--r-- | plugins/IEView/src/IEView.cpp | 8 | ||||
-rw-r--r-- | plugins/IEView/src/external_funcs.cpp | 42 | ||||
-rw-r--r-- | plugins/IEView/src/external_funcs.h | 2 |
3 files changed, 50 insertions, 2 deletions
diff --git a/plugins/IEView/src/IEView.cpp b/plugins/IEView/src/IEView.cpp index 9ceca7c676..fe6f254996 100644 --- a/plugins/IEView/src/IEView.cpp +++ b/plugins/IEView/src/IEView.cpp @@ -414,7 +414,7 @@ STDMETHODIMP_(ULONG) IEView::Release(void) STDMETHODIMP IEView::GetTypeInfoCount(UINT *pctinfo)
{
if (pctinfo == NULL) return E_INVALIDARG;
- *pctinfo = 2;
+ *pctinfo = 3;
return S_OK;
}
STDMETHODIMP IEView::GetTypeInfo(UINT, LCID, LPTYPEINFO*)
@@ -428,6 +428,8 @@ STDMETHODIMP IEView::GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames {
if (!wcscmp(L"db_get", rgszNames[i]))
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;
@@ -437,7 +439,7 @@ STDMETHODIMP IEView::GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames retval = DISP_E_UNKNOWNNAME;
}
}
- return S_OK;
+ return retval;
}
STDMETHODIMP IEView::Invoke(DISPID dispIdMember,
@@ -454,6 +456,8 @@ STDMETHODIMP IEView::Invoke(DISPID dispIdMember, {
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);
}
diff --git a/plugins/IEView/src/external_funcs.cpp b/plugins/IEView/src/external_funcs.cpp index 445c2e5df1..3f38f4d3f1 100644 --- a/plugins/IEView/src/external_funcs.cpp +++ b/plugins/IEView/src/external_funcs.cpp @@ -42,6 +42,48 @@ namespace External return S_OK;
}
+ HRESULT db_set(DISPPARAMS *pDispParams, VARIANT *pVarResult)
+ {
+ if (pDispParams->cArgs < 4 || pDispParams == nullptr)
+ return E_INVALIDARG;
+
+ MCONTACT hContact = pDispParams->rgvarg[3].intVal;
+ BSTR szModule = pDispParams->rgvarg[2].bstrVal;
+ BSTR szSetting = pDispParams->rgvarg[1].bstrVal;
+
+ DBVARIANT dbv = { 0 };
+
+ VARIANT& pVal = pDispParams->rgvarg[0];
+
+ switch (pVal.vt)
+ {
+ case VT_BSTR:
+ dbv.type = DBVT_WCHAR;
+ dbv.pwszVal = mir_wstrdup(pVal.bstrVal);
+ break;
+ case VT_INT:
+ case VT_I1:
+ case VT_I2:
+ case VT_I4:
+ case VT_I8:
+ dbv.type = DBVT_DWORD;
+ dbv.dVal = pVal.intVal;
+ break;
+ case VT_BOOL:
+ dbv.type = DBVT_BYTE;
+ dbv.bVal = pVal.boolVal;
+ }
+
+ INT_PTR res = ::db_set(hContact, _T2A((TCHAR*)szModule), _T2A((TCHAR*)szSetting), &dbv);
+
+ if (pVarResult != nullptr)
+ {
+ pVarResult->vt = VT_INT_PTR;
+ pVarResult->ullVal = (ULONGLONG)res;
+ }
+ return S_OK;
+ }
+
HRESULT win32_ShellExecute(DISPPARAMS *pDispParams, VARIANT *pVarResult)
{
if (pDispParams->cArgs < 5 || pDispParams == nullptr)
diff --git a/plugins/IEView/src/external_funcs.h b/plugins/IEView/src/external_funcs.h index 6b46424d35..a9526cb831 100644 --- a/plugins/IEView/src/external_funcs.h +++ b/plugins/IEView/src/external_funcs.h @@ -1,11 +1,13 @@ enum EXTERNAL_FUNCTIONS
{
DISPID_EXTERNAL_DB_GET = 652,
+ DISPID_EXTERNAL_DB_SET,
DISPID_EXTERNAL_WIN32_SHELL_EXECUTE
};
namespace External
{
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 |