summaryrefslogtreecommitdiff
path: root/plugins/IEView
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/IEView')
-rw-r--r--plugins/IEView/src/IEView.cpp4
-rw-r--r--plugins/IEView/src/external_funcs.cpp34
-rw-r--r--plugins/IEView/src/external_funcs.h4
3 files changed, 37 insertions, 5 deletions
diff --git a/plugins/IEView/src/IEView.cpp b/plugins/IEView/src/IEView.cpp
index c09544c6f7..2be1e2eacf 100644
--- a/plugins/IEView/src/IEView.cpp
+++ b/plugins/IEView/src/IEView.cpp
@@ -433,6 +433,8 @@ STDMETHODIMP IEView::GetIDsOfNames(REFIID /*riid*/, LPOLESTR *rgszNames, UINT cN
else if (!wcscmp(L"win32_ShellExecute", rgszNames[i]))
rgDispId[i] = DISPID_EXTERNAL_WIN32_SHELL_EXECUTE;
+ else if (!wcscmp(L"win32_CopyToClipboard", rgszNames[i]))
+ rgDispId[i] = DISPID_EXTERNAL_WIN32_COPY_TO_CLIPBOARD;
else if (!wcscmp(L"IEView_SetContextMenuHandler", rgszNames[i]))
rgDispId[i] = DISPID_EXTERNAL_SET_CONTEXTMENUHANDLER;
@@ -473,6 +475,8 @@ STDMETHODIMP IEView::Invoke(DISPID dispIdMember,
case DISPID_EXTERNAL_WIN32_SHELL_EXECUTE:
return External::win32_ShellExecute(pDispParams, pVarResult);
+ case DISPID_EXTERNAL_WIN32_COPY_TO_CLIPBOARD:
+ return External::win32_CopyToClipboard(pDispParams, pVarResult);
case DISPID_EXTERNAL_GET_CURRENTCONTACT:
return External::IEView_GetCurrentContact(this, pDispParams, pVarResult);
diff --git a/plugins/IEView/src/external_funcs.cpp b/plugins/IEView/src/external_funcs.cpp
index 3032cda757..b7150ff3c9 100644
--- a/plugins/IEView/src/external_funcs.cpp
+++ b/plugins/IEView/src/external_funcs.cpp
@@ -40,8 +40,8 @@ namespace External
if (pVarResult != nullptr)
{
- pVarResult->vt = VT_INT_PTR;
- pVarResult->ullVal = (ULONGLONG)res;
+ pVarResult->vt = VT_UINT;
+ pVarResult->uintVal = (UINT)res;
}
return S_OK;
}
@@ -151,8 +151,8 @@ namespace External
if (pVarResult != nullptr)
{
- pVarResult->vt = VT_INT_PTR;
- pVarResult->ullVal = (ULONGLONG)res;
+ pVarResult->vt = VT_INT;
+ pVarResult->intVal = (int)res;
}
return S_OK;
}
@@ -173,4 +173,30 @@ namespace External
return S_OK;
}
+ HRESULT win32_CopyToClipboard(DISPPARAMS *pDispParams, VARIANT *pVarResult)
+ {
+ if (pDispParams == nullptr || pDispParams->cArgs < 1)
+ return E_INVALIDARG;
+
+ BSTR data = pDispParams->rgvarg[0].bstrVal;
+ if (OpenClipboard(NULL))
+ {
+ EmptyClipboard();
+ size_t size = sizeof(TCHAR)* (mir_wstrlen(data) + 1);
+ HGLOBAL hClipboardData = GlobalAlloc(0, size);
+ if (hClipboardData)
+ {
+ TCHAR *pchData = (TCHAR*)GlobalLock(hClipboardData);
+ if (pchData)
+ {
+ memcpy(pchData, (TCHAR*)data, size);
+ GlobalUnlock(hClipboardData);
+ SetClipboardData(CF_UNICODETEXT, hClipboardData);
+ }
+ }
+ CloseClipboard();
+ }
+ return S_OK;
+ }
+
} \ No newline at end of file
diff --git a/plugins/IEView/src/external_funcs.h b/plugins/IEView/src/external_funcs.h
index a25f497016..0312c5929e 100644
--- a/plugins/IEView/src/external_funcs.h
+++ b/plugins/IEView/src/external_funcs.h
@@ -8,7 +8,8 @@ enum EXTERNAL_FUNCTIONS
DISPID_EXTERNAL_DB_GET = 652,
DISPID_EXTERNAL_DB_SET,
- DISPID_EXTERNAL_WIN32_SHELL_EXECUTE = 660
+ DISPID_EXTERNAL_WIN32_SHELL_EXECUTE = 660,
+ DISPID_EXTERNAL_WIN32_COPY_TO_CLIPBOARD
};
namespace External
@@ -22,4 +23,5 @@ namespace External
HRESULT db_set(DISPPARAMS *pDispParams, VARIANT *pVarResult);
HRESULT win32_ShellExecute(DISPPARAMS *pDispParams, VARIANT *pVarResult);
+ HRESULT win32_CopyToClipboard(DISPPARAMS *pDispParams, VARIANT *pVarResult);
} \ No newline at end of file