From 33953cc6a0fab6a91af293c6838f8a46dd7922da Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 10 Feb 2014 14:42:51 +0000 Subject: HCONTACT, part 3 git-svn-id: http://svn.miranda-ng.org/main/trunk@8081 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/QuickContacts/src/quickcontacts.cpp | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'plugins/QuickContacts/src/quickcontacts.cpp') diff --git a/plugins/QuickContacts/src/quickcontacts.cpp b/plugins/QuickContacts/src/quickcontacts.cpp index 6d35216f40..fd52f59a93 100644 --- a/plugins/QuickContacts/src/quickcontacts.cpp +++ b/plugins/QuickContacts/src/quickcontacts.cpp @@ -571,15 +571,12 @@ HCONTACT GetSelectedContact(HWND hwndDlg) } // get array position from handle -int GetItemPos(HANDLE hcontact) +int GetItemPos(HCONTACT hcontact) { - int loop; - - for(loop=0;loophcontact) + for(int loop=0; loop < contacts.getCount(); loop++) + if(hcontact == contacts[loop]->hcontact) return loop; - } + return -1; } @@ -819,12 +816,9 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA LoadContacts(hwndDlg, FALSE); EnableButtons(hwndDlg, NULL); - if (db_get_b(NULL, MODULE_NAME, "EnableLastSentTo", 0)) - { - int pos = GetItemPos((HANDLE) db_get_dw(NULL, MODULE_NAME, "LastSentTo", -1)); - - if (pos != -1) - { + if (db_get_b(NULL, MODULE_NAME, "EnableLastSentTo", 0)) { + int pos = GetItemPos((HCONTACT)db_get_dw(NULL, MODULE_NAME, "LastSentTo", -1)); + if (pos != -1) { SendDlgItemMessage(hwndDlg, IDC_USERNAME, CB_SETCURSEL, (WPARAM) pos, 0); EnableButtons(hwndDlg, contacts[pos]->hcontact); } -- cgit v1.2.3