summaryrefslogtreecommitdiff
path: root/plugins/SmileyAdd/src/AniSmileyObject.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-03-03 10:03:03 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-03-03 10:03:03 +0000
commit292cb6ecd2c5f834c8b535ca8bd6c678e84fab88 (patch)
treeda8a7590001734fc1de68ddebed124827828c6fb /plugins/SmileyAdd/src/AniSmileyObject.cpp
parent5fe02998f36882b52451743f831e811c051b395f (diff)
- CComPtr rulez;
- obsolete code removed; git-svn-id: http://svn.miranda-ng.org/main/trunk@16400 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/SmileyAdd/src/AniSmileyObject.cpp')
-rw-r--r--plugins/SmileyAdd/src/AniSmileyObject.cpp39
1 files changed, 20 insertions, 19 deletions
diff --git a/plugins/SmileyAdd/src/AniSmileyObject.cpp b/plugins/SmileyAdd/src/AniSmileyObject.cpp
index c437b9ab5a..176d0760c3 100644
--- a/plugins/SmileyAdd/src/AniSmileyObject.cpp
+++ b/plugins/SmileyAdd/src/AniSmileyObject.cpp
@@ -84,32 +84,33 @@ public:
void GetDrawingProp()
{
- if (m_hwnd == NULL) return;
-
- IRichEditOle* RichEditOle;
- if (SendMessage(m_hwnd, EM_GETOLEINTERFACE, 0, (LPARAM)&RichEditOle) == 0)
+ if (m_hwnd == NULL)
return;
REOBJECT reObj = { 0 };
- reObj.cbStruct = sizeof(REOBJECT);
+ reObj.cbStruct = sizeof(reObj);
+ {
+ CComPtr<IRichEditOle> RichEditOle;
+ if (SendMessage(m_hwnd, EM_GETOLEINTERFACE, 0, (LPARAM)&RichEditOle) == 0)
+ return;
- HRESULT hr = RichEditOle->GetObject(m_lastObjNum, &reObj, REO_GETOBJ_NO_INTERFACES);
- if (hr == S_OK && reObj.dwUser == (DWORD_PTR)this && reObj.clsid == CLSID_NULL)
- m_richFlags = reObj.dwFlags;
- else {
- long objectCount = RichEditOle->GetObjectCount();
- for (long i = objectCount; i--; ) {
- hr = RichEditOle->GetObject(i, &reObj, REO_GETOBJ_NO_INTERFACES);
- if (FAILED(hr)) continue;
-
- if (reObj.dwUser == (DWORD_PTR)this && reObj.clsid == CLSID_NULL) {
- m_lastObjNum = i;
- m_richFlags = reObj.dwFlags;
- break;
+ HRESULT hr = RichEditOle->GetObject(m_lastObjNum, &reObj, REO_GETOBJ_NO_INTERFACES);
+ if (SUCCEEDED(hr) && reObj.dwUser == (DWORD_PTR)this && reObj.clsid == CLSID_NULL)
+ m_richFlags = reObj.dwFlags;
+ else {
+ long objectCount = RichEditOle->GetObjectCount();
+ for (long i = objectCount; i--; ) {
+ hr = RichEditOle->GetObject(i, &reObj, REO_GETOBJ_NO_INTERFACES);
+ if (FAILED(hr)) continue;
+
+ if (reObj.dwUser == (DWORD_PTR)this && reObj.clsid == CLSID_NULL) {
+ m_lastObjNum = i;
+ m_richFlags = reObj.dwFlags;
+ break;
+ }
}
}
}
- RichEditOle->Release();
if ((m_richFlags & REO_SELECTED) == 0) {
CHARRANGE sel;