From 6029165c364f93a84ab7e98ef71d3a711b0f588c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 10 Apr 2013 21:08:51 +0000 Subject: attempt to fix the most crazy pieces of status icons related code git-svn-id: http://svn.miranda-ng.org/main/trunk@4417 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/UserInfoEx/src/Flags/svc_flags.cpp | 45 ++++++++---------------------- 1 file changed, 12 insertions(+), 33 deletions(-) (limited to 'plugins/UserInfoEx/src/Flags') diff --git a/plugins/UserInfoEx/src/Flags/svc_flags.cpp b/plugins/UserInfoEx/src/Flags/svc_flags.cpp index ced26a1b07..75cdf0f5cf 100644 --- a/plugins/UserInfoEx/src/Flags/svc_flags.cpp +++ b/plugins/UserInfoEx/src/Flags/svc_flags.cpp @@ -336,46 +336,25 @@ MsgWndData::~MsgWndData() { FlagsIconUnset(); //check if realy need } -void -MsgWndData::FlagsIconSet() { - HICON hIcon = NULL; - StatusIconData sid = {0}; - sid.cbSize = sizeof(sid); - sid.szModule = MODNAMEFLAGS; +void MsgWndData::FlagsIconSet() +{ /* ensure status icon is registered */ - if ( m_countryID!=0xFFFF || gFlagsOpts.bUseUnknownFlag) { - /* copy icon as status icon API will call DestroyIcon() on it */ - hIcon = LoadFlagIcon(m_countryID); - sid.hIcon = (hIcon!=NULL)?CopyIcon(hIcon):NULL; - Skin_ReleaseIcon(hIcon); /* does NULL check */ - hIcon = sid.hIcon; - sid.dwId = (DWORD)m_countryID; - sid.hIconDisabled = sid.hIcon/*NULL*/; - sid.szTooltip = Translate((char*)CallService(MS_UTILS_GETCOUNTRYBYNUMBER,m_countryID,0)); - sid.flags = 0; + if (m_countryID != 0xFFFF || gFlagsOpts.bUseUnknownFlag) { + StatusIconData sid = { sizeof(sid) }; + sid.szModule = MODNAMEFLAGS; + sid.hIconDisabled = sid.hIcon = LoadFlagIcon(m_countryID); + sid.szTooltip = Translate((char*)CallService(MS_UTILS_GETCOUNTRYBYNUMBER,m_countryID,0)); if(CallService(MS_MSG_MODIFYICON,(WPARAM)m_hContact,(LPARAM)&sid) !=0) /* not yet registered? */ CallService(MS_MSG_ADDICON,0,(LPARAM)&sid); } - sid.hIcon = NULL; - sid.szTooltip = NULL; - sid.hIconDisabled = NULL; - for(int i=0;i