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/src/external_funcs.cpp | |
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/src/external_funcs.cpp')
-rw-r--r-- | plugins/IEView/src/external_funcs.cpp | 42 |
1 files changed, 42 insertions, 0 deletions
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)
|