From 2799d3c1c54f5b4681b45b76cfdacb081312ae88 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 6 Jul 2012 20:23:55 +0000 Subject: - crash fix in Clist Modern cache - code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@800 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_modern/modern_extraimage.cpp | 290 ++++++++++++++--------------- 1 file changed, 145 insertions(+), 145 deletions(-) (limited to 'plugins/Clist_modern/modern_extraimage.cpp') diff --git a/plugins/Clist_modern/modern_extraimage.cpp b/plugins/Clist_modern/modern_extraimage.cpp index 2fb3a26331..6217592c07 100644 --- a/plugins/Clist_modern/modern_extraimage.cpp +++ b/plugins/Clist_modern/modern_extraimage.cpp @@ -7,18 +7,18 @@ boolean visar[EXTRACOLUMNCOUNT]; int ExtraImageIconsIndex[ExtraImageIconsIndexCount]; -int EnabledColumnCount=0; -BOOL g_mutex_bSetAllExtraIconsCycle=0; +int EnabledColumnCount = 0; +BOOL g_mutex_bSetAllExtraIconsCycle = 0; -static HIMAGELIST hExtraImageList=NULL; -static HIMAGELIST hWideExtraImageList=NULL; +static HIMAGELIST hExtraImageList = NULL; +static HIMAGELIST hWideExtraImageList = NULL; void ExtraImage_SetAllExtraIcons(HWND hwndList,HANDLE hContact); void ClearExtraIcons(); -boolean ImageCreated=FALSE; -BYTE ExtraOrder[]= +boolean ImageCreated = FALSE; +BYTE ExtraOrder[] = { 1, // EXTRA_ICON_EMAIL 2, // EXTRA_ICON_PROTO @@ -42,9 +42,9 @@ boolean isColumnVisible(int extra) if (HasExtraIconsService()) return true; - int i=0; - for (i=0; i=EXTRACOLUMNCOUNT){return(-1);}; - if (to<0||to>=EXTRACOLUMNCOUNT){return(-1);}; - if (to= EXTRACOLUMNCOUNT){return(-1);}; + if (to < 0||to >= EXTRACOLUMNCOUNT){return(-1);}; + if (to < from){return(-1);}; - sum=0; - for (i=from;i<=to;i++) + sum = 0; + for (i = from;i <= to;i++) { - sum+=bti(visar[i]); + sum += bti(visar[i]); }; return(sum); }; @@ -110,7 +110,7 @@ int ExtraImage_ExtraIDToColumnNum(int extra) return extra-1; } - int ord=ExtraOrder[extra-1]; + int ord = ExtraOrder[extra-1]; if (!visar[ord]) return -1; return (colsum(0,ord)-1); }; @@ -120,8 +120,8 @@ int ExtraImage_ColumnNumToExtraID(int column) if (HasExtraIconsService()) return column+1; - for (int i=0; ihwndContactTree==0){return(-1);}; - if (wParam==0||lParam==0){return(-1);}; - piec=(pIconExtraColumn)lParam; + if (pcli->hwndContactTree == 0){return(-1);}; + if (wParam == 0||lParam == 0){return(-1);}; + piec = (pIconExtraColumn)lParam; - if (piec->cbSize!=sizeof(IconExtraColumn)){return(-1);}; - icol=ExtraImage_ExtraIDToColumnNum(piec->ColumnType); - if (icol==-1){return(-1);}; - hItem=(HANDLE)SendMessage(pcli->hwndContactTree,CLM_FINDCONTACT,(WPARAM)wParam,0); - if (hItem==0){return(-1);}; + if (piec->cbSize != sizeof(IconExtraColumn)){return(-1);}; + icol = ExtraImage_ExtraIDToColumnNum(piec->ColumnType); + if (icol == -1){return(-1);}; + hItem = (HANDLE)SendMessage(pcli->hwndContactTree,CLM_FINDCONTACT,(WPARAM)wParam,0); + if (hItem == 0){return(-1);}; SendMessage(pcli->hwndContactTree,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(icol,piec->hImage)); return(0); }; -//wparam=hIcon +//wparam = hIcon //return hImage on success,-1 on failure INT_PTR AddIconToExtraImageList(WPARAM wParam,LPARAM lParam) { - int res=-1; - if (hExtraImageList==0||wParam==0){return(-1);}; - res=((int)ImageList_AddIcon(hExtraImageList,(HICON)wParam)); + int res = -1; + if (hExtraImageList == 0||wParam == 0){return(-1);}; + res = ((int)ImageList_AddIcon(hExtraImageList,(HICON)wParam)); if (res>254) return -1; return res; }; @@ -164,9 +164,9 @@ void SetNewExtraColumnCount() int newcount; LoadPositionsFromDB(ExtraOrder); GetVisColumns(); - newcount=colsum(0,EXTRACOLUMNCOUNT-1); + newcount = colsum(0,EXTRACOLUMNCOUNT-1); db_set_b(NULL,CLUIFrameModule,"EnabledColumnCount",(BYTE)newcount); - EnabledColumnCount=newcount; + EnabledColumnCount = newcount; SendMessage(pcli->hwndContactTree,CLM_SETEXTRACOLUMNS,EnabledColumnCount,0); }; @@ -182,8 +182,8 @@ void ExtraImage_ReloadExtraIcons() if (hExtraImageList){ImageList_Destroy(hExtraImageList);}; if (hWideExtraImageList){ImageList_Destroy(hWideExtraImageList);}; - hExtraImageList=ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),ILC_COLOR32|ILC_MASK,1,256); - hWideExtraImageList=ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),ILC_COLOR32|ILC_MASK,1,256); + hExtraImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),ILC_COLOR32|ILC_MASK,1,256); + hWideExtraImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),ILC_COLOR32|ILC_MASK,1,256); if (!HasExtraIconsService()) { @@ -191,21 +191,21 @@ void ExtraImage_ReloadExtraIcons() //loading icons hIcon = LoadSkinnedIcon(SKINICON_OTHER_SENDEMAIL); - ExtraImageIconsIndex[0]=ImageList_AddIcon(hExtraImageList, hIcon); + ExtraImageIconsIndex[0] = ImageList_AddIcon(hExtraImageList, hIcon); CallService(MS_SKIN2_RELEASEICON, (WPARAM)hIcon, 0); hIcon = LoadSkinnedIcon(SKINICON_OTHER_SMS); - ExtraImageIconsIndex[1]=ImageList_AddIcon(hExtraImageList, hIcon); + ExtraImageIconsIndex[1] = ImageList_AddIcon(hExtraImageList, hIcon); CallService(MS_SKIN2_RELEASEICON, (WPARAM)hIcon, 0); hIcon = LoadSkinnedIcon(SKINICON_EVENT_URL); - ExtraImageIconsIndex[2]=ImageList_AddIcon(hExtraImageList, hIcon); + ExtraImageIconsIndex[2] = ImageList_AddIcon(hExtraImageList, hIcon); CallService(MS_SKIN2_RELEASEICON, (WPARAM)hIcon, 0); //calc only needed protocols //adding protocol icons ProtoEnumAccounts( &count, &accs ); - for(i=0;iszModuleName, PS_GETCAPS,PFLAGNUM_2, 0 )== 0) + if (!IsAccountEnabled(accs[i]) || CallProtoService(accs[i]->szModuleName, PS_GETCAPS,PFLAGNUM_2, 0 ) == 0) continue; hIcon = LoadSkinnedProtoIcon(accs[i]->szModuleName,ID_STATUS_ONLINE); @@ -213,19 +213,19 @@ void ExtraImage_ReloadExtraIcons() CallService(MS_SKIN2_RELEASEICON, (WPARAM)hIcon, 0); } - hicon=CLUI_LoadIconFromExternalFile("clisticons.dll",5,TRUE,TRUE,"AlwaysVis","Contact List",Translate("Always Visible"),-IDI_ALWAYSVIS,&needFree); - if (!hicon) {hicon=LoadSmallIcon(g_hInst, MAKEINTRESOURCE(IDI_ALWAYSVIS));needFree=TRUE;} - ExtraImageIconsIndex[3]=ImageList_AddIcon(hExtraImageList,hicon ); + hicon = CLUI_LoadIconFromExternalFile("clisticons.dll",5,TRUE,TRUE,"AlwaysVis","Contact List",Translate("Always Visible"),-IDI_ALWAYSVIS,&needFree); + if (!hicon) {hicon = LoadSmallIcon(g_hInst, MAKEINTRESOURCE(IDI_ALWAYSVIS));needFree = TRUE;} + ExtraImageIconsIndex[3] = ImageList_AddIcon(hExtraImageList,hicon ); if (needFree) DestroyIcon_protect(hicon); - hicon=CLUI_LoadIconFromExternalFile("clisticons.dll",6,TRUE,TRUE,"NeverVis","Contact List",Translate("Never Visible"),-IDI_NEVERVIS,&needFree); - if (!hicon) {hicon=LoadSmallIcon(g_hInst, MAKEINTRESOURCE(IDI_NEVERVIS));needFree=TRUE;} - ExtraImageIconsIndex[4]=ImageList_AddIcon(hExtraImageList,hicon ); + hicon = CLUI_LoadIconFromExternalFile("clisticons.dll",6,TRUE,TRUE,"NeverVis","Contact List",Translate("Never Visible"),-IDI_NEVERVIS,&needFree); + if (!hicon) {hicon = LoadSmallIcon(g_hInst, MAKEINTRESOURCE(IDI_NEVERVIS));needFree = TRUE;} + ExtraImageIconsIndex[4] = ImageList_AddIcon(hExtraImageList,hicon ); if (needFree) DestroyIcon_protect(hicon); - hicon=CLUI_LoadIconFromExternalFile("clisticons.dll",7,TRUE,TRUE,"ChatActivity","Contact List",Translate("Chat Activity"),-IDI_CHAT,&needFree); - if (!hicon) {hicon=LoadSmallIcon(g_hInst, MAKEINTRESOURCE(IDI_CHAT));needFree=TRUE;} - ExtraImageIconsIndex[5]=ImageList_AddIcon(hExtraImageList,hicon ); + hicon = CLUI_LoadIconFromExternalFile("clisticons.dll",7,TRUE,TRUE,"ChatActivity","Contact List",Translate("Chat Activity"),-IDI_CHAT,&needFree); + if (!hicon) {hicon = LoadSmallIcon(g_hInst, MAKEINTRESOURCE(IDI_CHAT));needFree = TRUE;} + ExtraImageIconsIndex[5] = ImageList_AddIcon(hExtraImageList,hicon ); if (needFree) DestroyIcon_protect(hicon); } @@ -233,7 +233,7 @@ void ExtraImage_ReloadExtraIcons() //ExtraImage_SetAllExtraIcons(hImgList); SetNewExtraColumnCount(); NotifyEventHooks(g_CluiData.hEventExtraImageListRebuilding,0,0); - ImageCreated=TRUE; + ImageCreated = TRUE; } void ReAssignExtraIcons() @@ -249,100 +249,100 @@ void ClearExtraIcons() int i; HANDLE hContact,hItem; - //EnabledColumnCount=DBGetContactSettingByte(NULL,CLUIFrameModule,"EnabledColumnCount",5); + //EnabledColumnCount = DBGetContactSettingByte(NULL,CLUIFrameModule,"EnabledColumnCount",5); //SendMessage(pcli->hwndContactTree,CLM_SETEXTRACOLUMNS,EnabledColumnCount,0); SetNewExtraColumnCount(); - hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0); + hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0); do { - hItem=(HANDLE)SendMessage(pcli->hwndContactTree,CLM_FINDCONTACT,(WPARAM)hContact,0); - if (hItem==0){continue;}; - for (i=0;ihwndContactTree,CLM_FINDCONTACT,(WPARAM)hContact,0); + if (hItem == 0){continue;}; + for (i = 0;i < EnabledColumnCount;i++) { SendMessage(pcli->hwndContactTree,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(i,0xFF)); }; - } while(hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0)); + } while(hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0)); }; void ExtraImage_SetAllExtraIcons(HWND hwndList,HANDLE hContact) { HANDLE hItem; - int locApparentMode=0; - char * locApparentModeProto=NULL; - boolean hcontgiven=FALSE; + int locApparentMode = 0; + char * locApparentModeProto = NULL; + boolean hcontgiven = FALSE; char *szProto; char *(ImgIndex[64]); int maxpr,count,i; PROTOACCOUNT **accs; pdisplayNameCacheEntry pdnce; int em,pr,sms,a1,a2,w1,c1; - int tick=0; - g_mutex_bSetAllExtraIconsCycle=1; - hcontgiven=(hContact!=0); + int tick = 0; + g_mutex_bSetAllExtraIconsCycle = 1; + hcontgiven = (hContact != 0); - if (pcli->hwndContactTree==0){return;}; - tick=GetTickCount(); - if (ImageCreated==FALSE) ExtraImage_ReloadExtraIcons(); + if (pcli->hwndContactTree == 0){return;}; + tick = GetTickCount(); + if (ImageCreated == FALSE) ExtraImage_ReloadExtraIcons(); SetNewExtraColumnCount(); BOOL hasExtraIconsService = HasExtraIconsService(); if (!hasExtraIconsService) { - em=ExtraImage_ExtraIDToColumnNum(EXTRA_ICON_EMAIL); - pr=ExtraImage_ExtraIDToColumnNum(EXTRA_ICON_PROTO); - sms=ExtraImage_ExtraIDToColumnNum(EXTRA_ICON_SMS); - a1=ExtraImage_ExtraIDToColumnNum(EXTRA_ICON_ADV1); - a2=ExtraImage_ExtraIDToColumnNum(EXTRA_ICON_ADV2); - w1=ExtraImage_ExtraIDToColumnNum(EXTRA_ICON_WEB); - c1=ExtraImage_ExtraIDToColumnNum(EXTRA_ICON_CLIENT); + em = ExtraImage_ExtraIDToColumnNum(EXTRA_ICON_EMAIL); + pr = ExtraImage_ExtraIDToColumnNum(EXTRA_ICON_PROTO); + sms = ExtraImage_ExtraIDToColumnNum(EXTRA_ICON_SMS); + a1 = ExtraImage_ExtraIDToColumnNum(EXTRA_ICON_ADV1); + a2 = ExtraImage_ExtraIDToColumnNum(EXTRA_ICON_ADV2); + w1 = ExtraImage_ExtraIDToColumnNum(EXTRA_ICON_WEB); + c1 = ExtraImage_ExtraIDToColumnNum(EXTRA_ICON_CLIENT); memset( ImgIndex, 0, sizeof( ImgIndex )); ProtoEnumAccounts( &count, &accs ); - maxpr=0; + maxpr = 0; //calc only needed protocols - for(i=0;iszModuleName,PS_GETCAPS,PFLAGNUM_2,0)==0) continue; - ImgIndex[maxpr]=accs[i]->szModuleName; + for(i = 0;i < count;i++) { + if ( !IsAccountEnabled( accs[i] ) || CallProtoService(accs[i]->szModuleName,PS_GETCAPS,PFLAGNUM_2,0) == 0) continue; + ImgIndex[maxpr] = accs[i]->szModuleName; maxpr++; } } - if (hContact==NULL) + if (hContact == NULL) { - hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0); + hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0); } do { - szProto=NULL; - hItem=hContact; - if (hItem==0){continue;}; - pdnce=(pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(hItem); - if (pdnce==NULL) {continue;}; + szProto = NULL; + hItem = hContact; + if (hItem == 0){continue;}; + pdnce = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(hItem); + if (pdnce == NULL) {continue;}; - // szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0); - szProto=pdnce->m_cache_cszProto; + // szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0); + szProto = pdnce->m_cache_cszProto; if (!hasExtraIconsService) { { boolean showweb; - showweb=FALSE; - if (ExtraImage_ExtraIDToColumnNum(EXTRA_ICON_WEB)!=-1) + showweb = FALSE; + if (ExtraImage_ExtraIDToColumnNum(EXTRA_ICON_WEB) != -1) { - if (szProto != NULL) + if (szProto !=NULL) { char *homepage; - homepage= db_get_sa(pdnce->m_cache_hContact,"UserInfo", "Homepage"); + homepage = db_get_sa(pdnce->m_cache_hContact,"UserInfo", "Homepage"); if (!homepage) - homepage= db_get_sa(pdnce->m_cache_hContact,pdnce->m_cache_cszProto, "Homepage"); - if (homepage!=NULL) + homepage = db_get_sa(pdnce->m_cache_hContact,pdnce->m_cache_cszProto, "Homepage"); + if (homepage != NULL) { - showweb=TRUE; + showweb = TRUE; mir_free_and_nill(homepage); } } @@ -350,17 +350,17 @@ void ExtraImage_SetAllExtraIcons(HWND hwndList,HANDLE hContact) } } { - DBVARIANT dbv={0}; + DBVARIANT dbv = {0}; boolean showemail; - showemail=TRUE; - if (ExtraImage_ExtraIDToColumnNum(EXTRA_ICON_EMAIL)!=-1) + showemail = TRUE; + if (ExtraImage_ExtraIDToColumnNum(EXTRA_ICON_EMAIL) != -1) { if (szProto == NULL || DBGetContactSettingString(hContact, szProto, "e-mail",&dbv)) { db_free(&dbv); if (DBGetContactSettingString(hContact, "UserInfo", "Mye-mail0", &dbv)) - showemail=FALSE; + showemail = FALSE; } SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(ExtraImage_ExtraIDToColumnNum(EXTRA_ICON_EMAIL),(showemail)?0:0xFF)); db_free(&dbv); @@ -368,25 +368,25 @@ void ExtraImage_SetAllExtraIcons(HWND hwndList,HANDLE hContact) } { - DBVARIANT dbv={0}; + DBVARIANT dbv = {0}; boolean showsms; - showsms=TRUE; - if (ExtraImage_ExtraIDToColumnNum(EXTRA_ICON_SMS)!=-1) + showsms = TRUE; + if (ExtraImage_ExtraIDToColumnNum(EXTRA_ICON_SMS) != -1) { if (szProto == NULL || DBGetContactSettingString(hContact, szProto, "Cellular",&dbv)) { db_free(&dbv); if (DBGetContactSettingString(hContact, "UserInfo", "MyPhone0", &dbv)) - showsms=FALSE; + showsms = FALSE; } SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(ExtraImage_ExtraIDToColumnNum(EXTRA_ICON_SMS),(showsms)?1:0xFF)); db_free(&dbv); } } - if(ExtraImage_ExtraIDToColumnNum(EXTRA_ICON_PROTO)!=-1) + if (ExtraImage_ExtraIDToColumnNum(EXTRA_ICON_PROTO) != -1) { - for (i=0;iApparentMode==ID_STATUS_OFFLINE) - iconIndex=ExtraImageIconsIndex[4]; - else if (pdnce->ApparentMode==ID_STATUS_ONLINE) + if (pdnce->ApparentMode == ID_STATUS_OFFLINE) + iconIndex = ExtraImageIconsIndex[4]; + else if (pdnce->ApparentMode == ID_STATUS_ONLINE) { - if (szProto!=locApparentModeProto) + if (szProto != locApparentModeProto) { - locApparentModeProto=szProto; - locApparentMode=CallProtoService(locApparentModeProto,PS_GETSTATUS,0,0); + locApparentModeProto = szProto; + locApparentMode = CallProtoService(locApparentModeProto,PS_GETSTATUS,0,0); } - if(locApparentMode == ID_STATUS_INVISIBLE || db_get_b(NULL,"CList","AlwaysShowAlwaysVisIcon",SETTING_ALWAYSVISICON_DEFAULT) == 1) - iconIndex=ExtraImageIconsIndex[3]; } + if (locApparentMode == ID_STATUS_INVISIBLE || db_get_b(NULL,"CList","AlwaysShowAlwaysVisIcon",SETTING_ALWAYSVISICON_DEFAULT) == 1) + iconIndex = ExtraImageIconsIndex[3]; } } else { - if (pdnce->ApparentMode==ID_STATUS_OFFLINE) - iconIndex=ExtraImageIconsIndex[5]; - else iconIndex=255; + if (pdnce->ApparentMode == ID_STATUS_OFFLINE) + iconIndex = ExtraImageIconsIndex[5]; + else iconIndex = 255; } } SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(ExtraImage_ExtraIDToColumnNum(EXTRA_ICON_VISMODE),iconIndex)); @@ -427,22 +427,22 @@ void ExtraImage_SetAllExtraIcons(HWND hwndList,HANDLE hContact) NotifyEventHooks(g_CluiData.hEventExtraImageApplying,(WPARAM)hContact,0); if (hcontgiven) break; Sleep(0); - } while(hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0)); + } while(hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0)); - tick=GetTickCount()-tick; - g_mutex_bSetAllExtraIconsCycle=0; + tick = GetTickCount()-tick; + g_mutex_bSetAllExtraIconsCycle = 0; CLUI__cliInvalidateRect(hwndList,NULL,FALSE); Sleep(0); } HWND SetToolTip(HWND hwnd, TCHAR * tip); -HWND tipHWND=NULL; +HWND tipHWND = NULL; static int ehhShowExtraInfoTip(WPARAM wParam, LPARAM lParam) { - CLCEXTRAINFOTIP * eit=(CLCEXTRAINFOTIP *)lParam; - //tipHWND=SetToolTip(eit->hwnd,_T("TEST")); + CLCEXTRAINFOTIP * eit = (CLCEXTRAINFOTIP *)lParam; + //tipHWND = SetToolTip(eit->hwnd,_T("TEST")); //SendMessage(tipHWND,TTM_ACTIVATE,1,0); //SendMessage(tipHWND,TTM_POPUP,0,0); return 1; @@ -463,30 +463,30 @@ INT_PTR WideSetIconForExtraColumn(WPARAM wParam,LPARAM lParam) int icol; HANDLE hItem; - if (pcli->hwndContactTree==0){return(-1);}; - if (wParam==0||lParam==0){return(-1);}; - piec=(pIconExtraColumn)lParam; + if (pcli->hwndContactTree == 0){return(-1);}; + if (wParam == 0||lParam == 0){return(-1);}; + piec = (pIconExtraColumn)lParam; - if (piec->cbSize!=sizeof(IconExtraColumn)){return(-1);}; - icol=ExtraImage_ExtraIDToColumnNum(piec->ColumnType); - if (icol==-1){return(-1);}; + if (piec->cbSize != sizeof(IconExtraColumn)){return(-1);}; + icol = ExtraImage_ExtraIDToColumnNum(piec->ColumnType); + if (icol == -1){return(-1);}; - hItem=(HANDLE)SendMessage(pcli->hwndContactTree,CLM_FINDCONTACT,(WPARAM)wParam,0); - if (hItem==0){return(-1);}; - if (piec->hImage==(HANDLE)0xFF) piec->hImage=(HANDLE)0xFFFF; + hItem = (HANDLE)SendMessage(pcli->hwndContactTree,CLM_FINDCONTACT,(WPARAM)wParam,0); + if (hItem == 0){return(-1);}; + if (piec->hImage == (HANDLE)0xFF) piec->hImage = (HANDLE)0xFFFF; SendMessage(pcli->hwndContactTree,CLM_SETWIDEEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(icol,piec->hImage)); return(0); }; -//wparam=hIcon +//wparam = hIcon //return hImage on success,-1 on failure INT_PTR WideAddIconToExtraImageList(WPARAM wParam,LPARAM lParam) { - int res=-1; - if (hWideExtraImageList==0||wParam==0){return(-1);}; - res=((int)ImageList_AddIcon(hWideExtraImageList,(HICON)wParam)); - if (res==0xFF) res=((int)ImageList_AddIcon(hWideExtraImageList,(HICON)wParam)); + int res = -1; + if (hWideExtraImageList == 0||wParam == 0){return(-1);}; + res = ((int)ImageList_AddIcon(hWideExtraImageList,(HICON)wParam)); + if (res == 0xFF) res = ((int)ImageList_AddIcon(hWideExtraImageList,(HICON)wParam)); if (res>0xFFFE) return -1; return res; }; -- cgit v1.2.3