From eec361608fde60d63fe4511e26e3b95c7f72be13 Mon Sep 17 00:00:00 2001
From: George Hazan <george.hazan@gmail.com>
Date: Sun, 5 Jun 2016 16:11:08 +0000
Subject: - fix for #1059; - direct unsafe work with icons replaces with
 Window_SetIcon_IcoLib / Window_SetSkinIcon_IcoLib; - code cleaning

git-svn-id: http://svn.miranda-ng.org/main/trunk@16917 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
---
 protocols/Tlen/src/stdafx.h     | 2 ++
 protocols/Tlen/src/tlen.cpp     | 2 +-
 protocols/Tlen/src/tlen_svc.cpp | 7 ++-----
 3 files changed, 5 insertions(+), 6 deletions(-)

(limited to 'protocols/Tlen')

diff --git a/protocols/Tlen/src/stdafx.h b/protocols/Tlen/src/stdafx.h
index cc69fef948..9341656dc3 100644
--- a/protocols/Tlen/src/stdafx.h
+++ b/protocols/Tlen/src/stdafx.h
@@ -64,6 +64,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #include <m_contacts.h>
 #include <m_clist.h>
 #include <m_options.h>
+#include <m_icolib.h>
 #include <m_userinfo.h>
 #include <m_database.h>
 #include <m_langpack.h>
@@ -429,6 +430,7 @@ extern HANDLE hMainThread;
  * Function declarations
  *******************************************************************/
 HICON GetIcolibIcon(int iconId);
+HANDLE GetIconHandle(int iconId);
 void ReleaseIcolibIcon(HICON hIcon);
 
 void __cdecl TlenServerThread(ThreadData *info);
diff --git a/protocols/Tlen/src/tlen.cpp b/protocols/Tlen/src/tlen.cpp
index 250c5ae023..e7ce5b729b 100644
--- a/protocols/Tlen/src/tlen.cpp
+++ b/protocols/Tlen/src/tlen.cpp
@@ -80,7 +80,7 @@ static IconItem iconList[] =
 	{ LPGEN("Send image"),             "IMAGE",        IDI_IMAGE      }
 };
 
-static HANDLE GetIconHandle(int iconId)
+HANDLE GetIconHandle(int iconId)
 {
 	for (int i = 0; i < _countof(iconList); i++)
 		if (iconList[i].defIconID == iconId)
diff --git a/protocols/Tlen/src/tlen_svc.cpp b/protocols/Tlen/src/tlen_svc.cpp
index ab0cb4324c..9ce4fc360e 100644
--- a/protocols/Tlen/src/tlen_svc.cpp
+++ b/protocols/Tlen/src/tlen_svc.cpp
@@ -1057,13 +1057,10 @@ static INT_PTR CALLBACK TlenChangeAvatarDlgProc(HWND hwndDlg, UINT msg, WPARAM w
 	switch (msg) {
 	case WM_INITDIALOG:
 		TranslateDialogDefault(hwndDlg);
-		{
-			HICON hIcon = GetIcolibIcon(IDI_TLEN);
-			SendMessage(hwndDlg, WM_SETICON, (WPARAM)ICON_BIG, (LPARAM)hIcon);
-			ReleaseIcolibIcon(hIcon);
-		}
+		Window_SetIcon_IcoLib(hwndDlg, GetIconHandle(IDI_TLEN));
 		CheckDlgButton(hwndDlg, IDC_PUBLICAVATAR, BST_CHECKED);
 		return TRUE;
+
 	case WM_COMMAND:
 		switch (LOWORD(wParam)) {
 		case IDOK:
-- 
cgit v1.2.3