void CAimProto::ShowPopup(const char* msg, int flags, char* url) { POPUPDATAT ppd = {0}; mir_sntprintf(ppd.lptzContactName, SIZEOF(ppd.lptzContactName), TranslateT("%s Protocol"), m_tszUserName); if (flags & ERROR_POPUP) { if (flags & TCHAR_POPUP) { char* errmsg = mir_t2a((TCHAR*)msg); debugLogA(errmsg); mir_free(errmsg); } else debugLogA(msg); } TCHAR *msgt = (flags & TCHAR_POPUP) ? mir_tstrdup((TCHAR*)msg) : mir_a2t(msg); mir_sntprintf(ppd.lptzText, SIZEOF(ppd.lptzText), _T("%s"), TranslateTS(msgt)); mir_free(msgt); if (!ServiceExists(MS_POPUP_ADDPOPUPT)) { if (flags & MAIL_POPUP) { size_t len = _tcslen(ppd.lptzText); mir_sntprintf(&ppd.lptzText[len], SIZEOF(ppd.lptzText) - len, _T(" %s"), TranslateT("Open mail account?")); if (MessageBox(NULL, ppd.lptzText, ppd.lptzContactName, MB_YESNO | MB_ICONINFORMATION) == IDYES) ShellExecuteA(NULL, "open", url, NULL, NULL, SW_SHOW); } else { MessageBox(NULL, ppd.lptzText, ppd.lptzContactName, MB_OK | MB_ICONINFORMATION); } } else { ppd.PluginWindowProc = PopupWindowProc; ppd.lchIcon = LoadIconEx("aim"); if (flags & MAIL_POPUP) { ppd.PluginData = new CAimPopupData(this, url); ppd.iSeconds = -1; } else ppd.PluginData = new CAimPopupData(this, NULL); CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&ppd, 0); } }
BOOL CJabberProto::AddClistHttpAuthEvent(CJabberHttpAuthParams *pParams) { char szService[256]; mir_snprintf(szService, "%s%s", m_szModuleName, JS_HTTP_AUTH); CLISTEVENT cle = { 0 }; cle.cbSize = sizeof(CLISTEVENT); cle.hIcon = (HICON)LoadIconEx("openid"); cle.flags = CLEF_PROTOCOLGLOBAL | CLEF_TCHAR; cle.hDbEvent = -99; cle.lParam = (LPARAM)pParams; cle.pszService = szService; cle.ptszTooltip = TranslateT("Http authentication request received"); CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle); return TRUE; }
int ShowPopup(HANDLE hContact, SESSION_INFO *si, HICON hIcon, char* pszProtoName, TCHAR* pszRoomName, COLORREF crBkg, const TCHAR* fmt, ...) { POPUPDATAT pd = { 0 }; va_list marker; static TCHAR szBuf[4 * 1024]; if (!fmt || lstrlen(fmt) == 0 || lstrlen(fmt) > 2000) return 0; va_start(marker, fmt); mir_vsntprintf(szBuf, SIZEOF(szBuf), fmt, marker); va_end(marker); pd.lchContact = hContact; if (hIcon) pd.lchIcon = hIcon; else pd.lchIcon = LoadIconEx(IDI_CHANMGR, "window", 0, 0); PROTOACCOUNT *pa = ProtoGetAccount(pszProtoName); mir_sntprintf(pd.lptzContactName, MAX_CONTACTNAME - 1, _T("%s - %s"), (pa == NULL) ? _A2T(pszProtoName) : pa->tszAccountName, pcli->pfnGetContactDisplayName(hContact, 0)); lstrcpyn(pd.lptzText, TranslateTS(szBuf), MAX_SECONDLINE); pd.iSeconds = g_Settings.iPopupTimeout; if (g_Settings.iPopupStyle == 2) { pd.colorBack = 0; pd.colorText = 0; } else if (g_Settings.iPopupStyle == 3) { pd.colorBack = g_Settings.crPUBkgColour; pd.colorText = g_Settings.crPUTextColour; } else { pd.colorBack = g_Settings.crLogBackground; pd.colorText = crBkg; } pd.PluginWindowProc = PopupDlgProc; pd.PluginData = si; return PUAddPopupT(&pd); }
HBITMAP IconBitmapUtils::IconToBitmapPARGB32(HINSTANCE hInst, UINT uIcon) { std::map<UINT, HBITMAP>::iterator bitmap_it = bitmaps.lower_bound(uIcon); if (bitmap_it != bitmaps.end() && bitmap_it->first == uIcon) return bitmap_it->second; int iconWidth = GetSystemMetrics(SM_CXSMICON); int iconHeight = GetSystemMetrics(SM_CYSMICON); auto hIcon = LoadIconEx(hInst, MAKEINTRESOURCE(uIcon), iconWidth, iconHeight); HBITMAP hBmp = IconToBitmapPARGB32(hIcon, iconWidth, iconHeight); DestroyIcon(hIcon); if(hBmp) bitmaps.insert(bitmap_it, std::make_pair(uIcon, hBmp)); return hBmp; }
void LoadIcons(void) { int i; for(i = 0; i < 20; i++) hIcons[i] = NULL; LoadLogIcons(); LoadMsgLogBitmaps(); hImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),IsWinVerXPPlus()? ILC_COLOR32 | ILC_MASK : ILC_COLOR16 | ILC_MASK,0,3); hIconsList = ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),IsWinVerXPPlus()? ILC_COLOR32 | ILC_MASK : ILC_COLOR16 | ILC_MASK,0,100); ImageList_AddIcon(hIconsList,LoadSkinnedIcon( SKINICON_EVENT_MESSAGE)); ImageList_AddIcon(hIconsList,LoadIconEx( "overlay", FALSE )); ImageList_SetOverlayImage(hIconsList, 1, 1); ImageList_AddIcon(hImageList,LoadImage(g_hInst,MAKEINTRESOURCE(IDI_BLANK),IMAGE_ICON,0,0,0)); ImageList_AddIcon(hImageList,LoadImage(g_hInst,MAKEINTRESOURCE(IDI_BLANK),IMAGE_ICON,0,0,0)); }
HICON __cdecl CMsnProto::GetIcon(int iconIndex) { if (LOWORD(iconIndex) == PLI_PROTOCOL) { if (iconIndex & PLIF_ICOLIBHANDLE) return (HICON)GetIconHandle(IDI_MSN); bool big = (iconIndex & PLIF_SMALL) == 0; HICON hIcon = LoadIconEx("main", big); if (iconIndex & PLIF_ICOLIB) return hIcon; hIcon = CopyIcon(hIcon); ReleaseIconEx("main", big); return hIcon; } return NULL; }
int ShowPopup(MCONTACT hContact, SESSION_INFO *si, HICON hIcon, char *pszProtoName, TCHAR*, COLORREF crBkg, const TCHAR *fmt, ...) { static TCHAR szBuf[4 * 1024]; if (!fmt || fmt[0] == 0 || mir_tstrlen(fmt) > 2000) return 0; va_list marker; va_start(marker, fmt); mir_vsntprintf(szBuf, 4096, fmt, marker); va_end(marker); POPUPDATAT pd = { 0 }; pd.lchContact = hContact; if (hIcon) pd.lchIcon = hIcon; else pd.lchIcon = LoadIconEx("window", FALSE); PROTOACCOUNT *pa = Proto_GetAccount(pszProtoName); mir_sntprintf(pd.lptzContactName, _T("%s - %s"), (pa == NULL) ? _A2T(pszProtoName) : pa->tszAccountName, cli.pfnGetContactDisplayName(hContact, 0)); mir_tstrncpy(pd.lptzText, TranslateTS(szBuf), _countof(pd.lptzText)); pd.iSeconds = g_Settings->iPopupTimeout; if (g_Settings->iPopupStyle == 2) { pd.colorBack = 0; pd.colorText = 0; } else if (g_Settings->iPopupStyle == 3) { pd.colorBack = g_Settings->crPUBkgColour; pd.colorText = g_Settings->crPUTextColour; } else { pd.colorBack = g_Settings->crLogBackground; pd.colorText = crBkg; } pd.PluginWindowProc = PopupDlgProc; pd.PluginData = si; return PUAddPopupT(&pd); }
void ShowMessage(int type, const TCHAR* format, ...) { POPUPDATAT pi = { 0 }; va_list va; va_start(va, format); int len = mir_vsntprintf(pi.lptzText, _countof(pi.lptzText) - 1, format, va); pi.lptzText[len] = 0; va_end(va); if (ServiceExists(MS_POPUP_ADDPOPUPT)) { mir_tstrcpy(pi.lptzContactName, TEXT(PluginName)); pi.lchIcon = LoadIconEx(IDI_VI); pi.PluginWindowProc = DlgProcPopup; pi.PluginData = (void*)type; PUAddPopupT(&pi); } else MessageBox(NULL, pi.lptzText, TEXT(PluginName), MB_OK | MB_ICONINFORMATION); }
void CJabberProto::InitPopups(void) { TCHAR desc[256]; mir_sntprintf(desc, SIZEOF(desc), _T("%s %s"), m_tszUserName, TranslateT("Errors")); char name[256]; mir_snprintf(name, SIZEOF(name), "%s_%s", m_szModuleName, "Error"); POPUPCLASS ppc = { sizeof(ppc) }; ppc.flags = PCF_TCHAR; ppc.ptszDescription = desc; ppc.pszName = name; ppc.hIcon = LoadIconEx("main"); ppc.colorBack = RGB(191, 0, 0); //Red ppc.colorText = RGB(255, 245, 225); //Yellow ppc.iSeconds = 60; m_hPopupClass = Popup_RegisterClass(&ppc); Skin_ReleaseIcon(ppc.hIcon); }
INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { static bool bDlgInit = false; // some controls send WM_COMMAND before or during WM_INITDIALOG static HANDLE hhkFontsReload = 0; static OPTTREE_OPTION *skinOptions = NULL; static int skinOptionsCount = 0; if (skinOptions) { int index = -1; OptTree_ProcessMessage(hwndDlg, msg, wParam, lParam, &index, IDC_SKIN_LIST_OPT, skinOptions, skinOptionsCount); if (index != -1) { if (mir_tstrcmp(skinOptions[index].pszSettingName, _T("Skin options")) == 0) { const PopupSkin *skin = 0; if (skin = skins.getSkin(PopupOptions.SkinPack)) { skin->setFlag(skinOptions[index].Data, skinOptions[index].bState ? true : false); } } else if (mir_tstrcmp(skinOptions[index].pszSettingName, _T("Global settings")) == 0) { switch (skinOptions[index].dwFlag) { case (1 << 0) : PopupOptions.DisplayTime = skinOptions[index].bState; break; case (1 << 1) : PopupOptions.DropShadow = skinOptions[index].bState; break; case (1 << 2) : PopupOptions.EnableFreeformShadows = skinOptions[index].bState; break; case (1 << 3) : PopupOptions.EnableAeroGlass = skinOptions[index].bState; break; case (1 << 4) : PopupOptions.UseWinColors = skinOptions[index].bState; break; case (1 << 5) : PopupOptions.UseMText = skinOptions[index].bState; break; } } updatePreviewImage(GetDlgItem(hwndDlg, IDC_PREVIEWBOX)); return FALSE; } } switch (msg) { case WM_INITDIALOG: { // Skin List HWND hCtrl = GetDlgItem(hwndDlg, IDC_SKINLIST); ListBox_ResetContent(hCtrl); for (const Skins::SKINLIST *sl = skins.getSkinList(); sl; sl = sl->next) { DWORD dwIndex = ListBox_AddString(hCtrl, sl->name); ListBox_SetItemData(hCtrl, dwIndex, sl->name); } ListBox_SetCurSel(hCtrl, ListBox_FindString(hCtrl, 0, PopupOptions.SkinPack)); // Skin List reload button SendDlgItemMessage(hwndDlg, IDC_BTN_RELOAD, BUTTONSETASFLATBTN, TRUE, 0); SendDlgItemMessage(hwndDlg, IDC_BTN_RELOAD, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx(IDI_RELOAD)); SendDlgItemMessage(hwndDlg, IDC_BTN_RELOAD, BUTTONADDTOOLTIP, (WPARAM)Translate("Refresh List"), 0); // Skin Option List SkinOptionList_Update(skinOptions, &skinOptionsCount, hwndDlg); // PreviewBox mir_subclassWindow(GetDlgItem(hwndDlg, IDC_PREVIEWBOX), WndProcPreviewBox); updatePreviewImage(GetDlgItem(hwndDlg, IDC_PREVIEWBOX)); // hooks hhkFontsReload = HookEventMessage(ME_FONT_RELOAD, hwndDlg, WM_USER); TranslateDialogDefault(hwndDlg); bDlgInit = true; } return TRUE; case WM_USER: updatePreviewImage(GetDlgItem(hwndDlg, IDC_PREVIEWBOX)); return TRUE; case WM_COMMAND: { HWND hCtrl = NULL; UINT idCtrl = LOWORD(wParam); switch (HIWORD(wParam)) { case BN_KILLFOCUS: // Button controls case BN_SETFOCUS: // Button controls return TRUE; case BN_CLICKED: // Button controls switch (idCtrl) { case IDC_PREVIEW: PopupPreview(); break; case IDC_GETSKINS: Utils_OpenUrl("http://miranda-ng.org/addons/category/13"); break; case IDC_BTN_RELOAD: LPTSTR pszOldSkin = NEWTSTR_ALLOCA(PopupOptions.SkinPack); skins.load(); hCtrl = GetDlgItem(hwndDlg, IDC_SKINLIST); ListBox_ResetContent(hCtrl); for (const Skins::SKINLIST *sl = skins.getSkinList(); sl; sl = sl->next) { DWORD dwIndex = ListBox_AddString(hCtrl, sl->name); ListBox_SetItemData(hCtrl, dwIndex, sl->name); } ListBox_SetCurSel(hCtrl, ListBox_FindString(hCtrl, 0, PopupOptions.SkinPack)); // make shure we have select skin (ListBox_SetCurSel may be fail) TCHAR szNewSkin[128]; ListBox_GetText(hCtrl, ListBox_GetCurSel(hCtrl), &szNewSkin); if (mir_tstrcmp(pszOldSkin, szNewSkin) != 0) { mir_free(PopupOptions.SkinPack); PopupOptions.SkinPack = mir_tstrdup(szNewSkin); } const PopupSkin *skin = 0; if (skin = skins.getSkin(PopupOptions.SkinPack)) { // update Skin Option List from reload SkinPack bDlgInit = false; bDlgInit = SkinOptionList_Update(skinOptions, &skinOptionsCount, hwndDlg); } SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; } updatePreviewImage(GetDlgItem(hwndDlg, IDC_PREVIEWBOX)); break; case CBN_SELCHANGE: // combo box controls switch (idCtrl) { case IDC_SKINLIST: { // Skin list change mir_free(PopupOptions.SkinPack); PopupOptions.SkinPack = mir_tstrdup((TCHAR *)SendDlgItemMessage( hwndDlg, IDC_SKINLIST, LB_GETITEMDATA, (WPARAM)SendDlgItemMessage(hwndDlg, IDC_SKINLIST, LB_GETCURSEL, 0, 0), 0)); const PopupSkin *skin = 0; if (skin = skins.getSkin(PopupOptions.SkinPack)) { mir_free(PopupOptions.SkinPack); PopupOptions.SkinPack = mir_tstrdup(skin->getName()); // update Skin Option List bDlgInit = false; bDlgInit = SkinOptionList_Update(skinOptions, &skinOptionsCount, hwndDlg); } updatePreviewImage(GetDlgItem(hwndDlg, IDC_PREVIEWBOX)); } SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; }// end switch(idCtrl) break; }// end switch (HIWORD(wParam)) break; }// end WM_COMMAND case WM_NOTIFY: if (!bDlgInit) return FALSE; switch (((LPNMHDR)lParam)->idFrom) { case 0: switch (((LPNMHDR)lParam)->code) { case PSN_RESET: LoadOption_Skins(); return TRUE; case PSN_APPLY: { // skin pack db_set_ts(NULL, MODULNAME, "SkinPack", PopupOptions.SkinPack); // skin options const PopupSkin *skin = 0; if (skin = skins.getSkin(PopupOptions.SkinPack)) skin->saveOpts(); skins.freeAllButActive(); // more Skin options db_set_b(NULL, MODULNAME, "DisplayTime", PopupOptions.DisplayTime); db_set_b(NULL, MODULNAME, "DropShadow", PopupOptions.DropShadow); db_set_b(NULL, MODULNAME, "EnableShadowRegion", PopupOptions.EnableFreeformShadows); db_set_b(NULL, MODULNAME, "EnableAeroGlass", PopupOptions.EnableAeroGlass); db_set_b(NULL, MODULNAME, "UseMText", PopupOptions.UseMText); }// end PSN_APPLY: return TRUE; }// switch (((LPNMHDR)lParam)->code) break; }// end switch (((LPNMHDR)lParam)->idFrom) return FALSE; case WM_DESTROY: if (wndPreview) { delete wndPreview; wndPreview = NULL; gPreviewOk = false; } if (hhkFontsReload) UnhookEvent(hhkFontsReload); if (skinOptions) { for (int i = 0; i < skinOptionsCount; ++i) { mir_free(skinOptions[i].pszOptionName); mir_free(skinOptions[i].pszSettingName); } mir_free(skinOptions); skinOptions = NULL; skinOptionsCount = 0; } return TRUE; }// end switch (msg) return FALSE; }
INT_PTR CALLBACK DlgProcMsnServLists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { switch(msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); { SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); HIMAGELIST hIml = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_MASK | ILC_COLOR32, 5, 5); HICON hIcon = LoadSkinnedIcon(SKINICON_OTHER_SMALLDOT); ImageList_AddIcon(hIml, hIcon); Skin_ReleaseIcon(hIcon); hIcon = LoadIconEx("list_lc"); ImageList_AddIcon(hIml, hIcon); SendDlgItemMessage(hwndDlg, IDC_ICON_LC, STM_SETICON, (WPARAM)hIcon, 0); hIcon = LoadIconEx("list_fl"); ImageList_AddIcon(hIml, hIcon); SendDlgItemMessage(hwndDlg, IDC_ICON_FL, STM_SETICON, (WPARAM)hIcon, 0); hIcon = LoadIconEx("list_al"); ImageList_AddIcon(hIml, hIcon); SendDlgItemMessage(hwndDlg, IDC_ICON_AL, STM_SETICON, (WPARAM)hIcon, 0); hIcon = LoadIconEx("list_bl"); ImageList_AddIcon(hIml, hIcon); SendDlgItemMessage(hwndDlg, IDC_ICON_BL, STM_SETICON, (WPARAM)hIcon, 0); hIcon = LoadIconEx("list_rl"); ImageList_AddIcon(hIml, hIcon); SendDlgItemMessage(hwndDlg, IDC_ICON_RL, STM_SETICON, (WPARAM)hIcon, 0); HWND hwndList = GetDlgItem(hwndDlg, IDC_LIST); SendMessage(hwndList, CLM_SETEXTRAIMAGELIST, 0, (LPARAM)hIml); SendMessage(hwndList, CLM_SETEXTRACOLUMNS, 5, 0); ResetListOptions(hwndList); EnableWindow(hwndList, ((CMsnProto*)lParam)->msnLoggedIn); } return TRUE; // case WM_SETFOCUS: // SetFocus(GetDlgItem(hwndDlg ,IDC_LIST)); // break; case WM_COMMAND: if (LOWORD(wParam) == IDC_LISTREFRESH) { HWND hwndList = GetDlgItem(hwndDlg, IDC_LIST); SendMessage(hwndList, CLM_AUTOREBUILD, 0, 0); CMsnProto* proto = (CMsnProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); EnableWindow(hwndList, proto->msnLoggedIn); } break; case WM_NOTIFY: { CMsnProto* proto = (CMsnProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); NMCLISTCONTROL* nmc = (NMCLISTCONTROL*)lParam; if (nmc->hdr.idFrom == 0 && nmc->hdr.code == (unsigned)PSN_APPLY) { HWND hwndList = GetDlgItem(hwndDlg, IDC_LIST); SaveSettings(NULL, hwndList, proto); SendMessage(hwndList, CLM_AUTOREBUILD, 0, 0); EnableWindow(hwndList, proto->msnLoggedIn); } else if (nmc->hdr.idFrom == IDC_LIST) { switch (nmc->hdr.code) { case CLN_NEWCONTACT: if ((nmc->flags & (CLNF_ISGROUP | CLNF_ISINFO)) == 0) SetContactIcons(nmc->hItem, nmc->hdr.hwndFrom, proto); break; case CLN_LISTREBUILT: AddPrivacyListEntries(nmc->hdr.hwndFrom, proto); SetAllContactIcons(NULL, nmc->hdr.hwndFrom, proto); break; case CLN_OPTIONSCHANGED: ResetListOptions(nmc->hdr.hwndFrom); break; case NM_CLICK: HANDLE hItem; DWORD hitFlags; int iImage; // Make sure we have an extra column, also we can't change RL list if (nmc->iColumn == -1 || nmc->iColumn == 4) break; // Find clicked item hItem = (HANDLE)SendMessage(nmc->hdr.hwndFrom, CLM_HITTEST, (WPARAM)&hitFlags, MAKELPARAM(nmc->pt.x,nmc->pt.y)); // Nothing was clicked if (hItem == NULL || !(IsHContactContact(hItem) || IsHContactInfo(hItem))) break; // It was not our extended icon if (!(hitFlags & CLCHT_ONITEMEXTRA)) break; // Get image in clicked column (0=none, 1=LL, 2=FL, 3=AL, 4=BL, 5=RL) iImage = SendMessage(nmc->hdr.hwndFrom, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(nmc->iColumn, 0)); iImage = iImage ? 0 : nmc->iColumn + 1; SendMessage(nmc->hdr.hwndFrom, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(nmc->iColumn, iImage)); if (iImage && SendMessage(nmc->hdr.hwndFrom, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(nmc->iColumn ^ 1, 0)) != EMPTY_EXTRA_ICON) if (nmc->iColumn == 2 || nmc->iColumn == 3) SendMessage(nmc->hdr.hwndFrom, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(nmc->iColumn ^ 1, 0)); // Activate Apply button SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; } } } break; case WM_DESTROY: HIMAGELIST hIml=(HIMAGELIST)SendDlgItemMessage(hwndDlg,IDC_LIST,CLM_GETEXTRAIMAGELIST,0,0); ImageList_Destroy(hIml); ReleaseIconEx("list_fl"); ReleaseIconEx("list_al"); ReleaseIconEx("list_bl"); ReleaseIconEx("list_rl"); break; } return FALSE; }
INT_PTR CALLBACK DlgProcView(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { RECT rc; switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); { SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadIconEx(IDI_VI, true)); SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIconEx(IDI_VI)); CHARFORMAT2 chf; chf.cbSize = sizeof(chf); SendDlgItemMessage(hwndDlg, IDC_VIEWVERSIONINFO, EM_GETCHARFORMAT, SCF_DEFAULT, (LPARAM)&chf); mir_tstrcpy(chf.szFaceName, TEXT("Courier New")); SendDlgItemMessage(hwndDlg, IDC_VIEWVERSIONINFO, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&chf); CMString buffer; PrintVersionInfo(buffer, (unsigned int)lParam); SetDlgItemText(hwndDlg, IDC_VIEWVERSIONINFO, buffer.c_str()); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); } if (lParam & VI_FLAG_PRNDLL) SetWindowText(hwndDlg, TranslateT("View Version Information (with DLLs)")); Utils_RestoreWindowPositionNoMove(hwndDlg, NULL, PluginName, "ViewInfo_"); ShowWindow(hwndDlg, SW_SHOW); break; case WM_SIZE: GetWindowRect(GetDlgItem(hwndDlg, IDC_FILEVER), &rc); int dx, dy; if (MyResizeGetOffset(GetDlgItem(hwndDlg, IDC_VIEWVERSIONINFO), LOWORD(lParam) - 20, HIWORD(lParam) - 30 - (rc.bottom - rc.top), &dx, &dy)) { HDWP hDwp = BeginDeferWindowPos(4); hDwp = MyResizeWindow(hDwp, hwndDlg, GetDlgItem(hwndDlg, IDC_FILEVER), 0, dy, 0, 0); hDwp = MyResizeWindow(hDwp, hwndDlg, GetDlgItem(hwndDlg, IDC_CLIPVER), dx / 2, dy, 0, 0); hDwp = MyResizeWindow(hDwp, hwndDlg, GetDlgItem(hwndDlg, IDCANCEL), dx, dy, 0, 0); hDwp = MyResizeWindow(hDwp, hwndDlg, GetDlgItem(hwndDlg, IDC_VIEWVERSIONINFO), 0, 0, dx, dy); EndDeferWindowPos(hDwp); } break; case WM_GETMINMAXINFO: { LPMINMAXINFO mmi = (LPMINMAXINFO)lParam; mmi->ptMinTrackSize.x = 400; // The minimum width in points mmi->ptMinTrackSize.y = 300; // The minimum height in points } break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_CLIPVER: CallService(MS_CRASHDUMPER_STORETOCLIP, 0, GetWindowLongPtr(hwndDlg, GWLP_USERDATA)); break; case IDC_FILEVER: CallService(MS_CRASHDUMPER_STORETOFILE, 0, GetWindowLongPtr(hwndDlg, GWLP_USERDATA)); break; case IDCANCEL: DestroyWindow(hwndDlg); break; } break; case WM_CONTEXTMENU: { HWND hView = GetDlgItem(hwndDlg, IDC_VIEWVERSIONINFO); GetWindowRect(hView, &rc); POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; if (PtInRect(&rc, pt)) { static const CHARRANGE all = { 0, -1 }; HMENU hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_CONTEXT)); HMENU hSubMenu = GetSubMenu(hMenu, 0); TranslateMenu(hSubMenu); CHARRANGE sel; SendMessage(hView, EM_EXGETSEL, 0, (LPARAM)&sel); if (sel.cpMin == sel.cpMax) EnableMenuItem(hSubMenu, IDM_COPY, MF_BYCOMMAND | MF_GRAYED); switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL)) { case IDM_COPY: SendMessage(hView, WM_COPY, 0, 0); break; case IDM_COPYALL: SendMessage(hView, EM_EXSETSEL, 0, (LPARAM)&all); SendMessage(hView, WM_COPY, 0, 0); SendMessage(hView, EM_EXSETSEL, 0, (LPARAM)&sel); break; case IDM_SELECTALL: SendMessage(hView, EM_EXSETSEL, 0, (LPARAM)&all); break; } DestroyMenu(hMenu); } } break; case WM_DESTROY: hViewWnd = NULL; IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, 0)); IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, 0)); Utils_SaveWindowPosition(hwndDlg, NULL, PluginName, "ViewInfo_"); if (servicemode) PostQuitMessage(0); break; } return FALSE; }
static INT_PTR CALLBACK Meta_SelectDialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); { DBCachedContact *cc = currDb->m_cache->GetCachedContact(lParam); if (cc == NULL) { DestroyWindow(hwndDlg); return TRUE; } if (cc->IsMeta()) { MessageBox(hwndDlg, TranslateT("This contact is a metacontact.\nYou can't add a metacontact to another metacontact.\n\nPlease choose another."), TranslateT("Metacontact conflict"), MB_ICONERROR); DestroyWindow(hwndDlg); return TRUE; } if (cc->IsSub()) { MessageBox(hwndDlg, TranslateT("This contact is already associated to a metacontact.\nYou cannot add a contact to multiple metacontacts."), TranslateT("Multiple metacontacts"), MB_ICONERROR); DestroyWindow(hwndDlg); return TRUE; } } SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); // user data is contact handle SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadIconEx(I_ADD)); // Initialize the graphical part CheckDlgButton(hwndDlg, IDC_ONLYAVAIL, BST_CHECKED); // Initially checked; display all metacontacts is only an option // Besides, we can check if there is at least one metacontact to add the contact to. if (BuildList(GetDlgItem(hwndDlg, IDC_METALIST), FALSE) <= 0) { if (MessageBox(hwndDlg, TranslateT(szConvMsg), TranslateT("No suitable metacontact found"), MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON1) == IDYES) Meta_Convert(lParam, 0); DestroyWindow(hwndDlg); return TRUE; } else { // get contact display name from clist TCHAR *ptszCDN = cli.pfnGetContactDisplayName(lParam, 0); if (!ptszCDN) ptszCDN = TranslateT("a contact"); // ... and set it to the Window title. TCHAR buf[256]; mir_sntprintf(buf, SIZEOF(buf), TranslateT("Adding %s..."), ptszCDN); SetWindowText(hwndDlg, buf); } ShowWindow(hwndDlg, SW_SHOWNORMAL); return TRUE; case WM_COMMAND: if (HIWORD(wParam) == LBN_DBLCLK) // emulate click ok Ok wParam = MAKEWPARAM(IDOK, BN_CLICKED); if (HIWORD(wParam) != BN_CLICKED) break; // Only clicks of buttons are relevant, let other COMMANDs through switch (LOWORD(wParam)) { case IDOK: { int item = SendDlgItemMessage(hwndDlg, IDC_METALIST, LB_GETCURSEL, 0, 0); // Get the index of the selected metacontact if (item == -1) return IDOK == MessageBox(hwndDlg, TranslateT("Please select a metacontact"), TranslateT("No metacontact selected"), MB_ICONHAND); MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); MCONTACT hMeta = (MCONTACT)SendMessage(GetDlgItem(hwndDlg, IDC_METALIST), LB_GETITEMDATA, item, 0); if (!Meta_Assign(hContact, hMeta, FALSE)) MessageBox(hwndDlg, TranslateT("Assignment to the metacontact failed."), TranslateT("Assignment failure"), MB_ICONERROR); } // fall through case IDCANCEL: DestroyWindow(hwndDlg); break; case IDC_CHK_SRT: SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_METALIST), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_METALIST), GWL_STYLE) ^ LBS_SORT); if (BuildList(GetDlgItem(hwndDlg, IDC_METALIST), IsDlgButtonChecked(hwndDlg, IDC_CHK_SRT) ? TRUE : FALSE) <= 0) { if (MessageBox(hwndDlg, TranslateT(szConvMsg), TranslateT("No suitable metacontact found"), MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON1) == IDYES) Meta_Convert(lParam, 0); DestroyWindow(hwndDlg); return TRUE; } break; } break; case WM_DESTROY: // Free all allocated memory and return the focus to the CList HWND clist = GetParent(hwndDlg); Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, 0)); EndDialog(hwndDlg, TRUE); SetFocus(clist); return TRUE; } return FALSE; // All other Message are not handled }
void WindowSetIcon(HWND hWnd, const char* name) { SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)LoadIconEx(name, TRUE)); SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)LoadIconEx(name, FALSE)); }
INT_PTR CALLBACK Meta_EditDialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { HWND hwnd; char *str; int sel, i; switch(msg) { case WM_INITDIALOG: { // Font necessary for all controls created with CreateWindowsEx //HFONT hfDefault = GetStockObject(DEFAULT_GUI_FONT); //HWND combo = GetDlgItem(hwndDlg,IDC_DEFAULT); int nb_contacts, default_contact_number, offline_contact_number; LVCOLUMN LvCol; TranslateDialogDefault( hwndDlg ); SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadIconEx(I_EDIT)); // Disable the 'Apply' button. EnableWindow(GetDlgItem(hwndDlg,IDC_VALIDATE),FALSE); // (from http://www.codeproject.com/listctrl/listview.asp) // initialize list hwnd = GetDlgItem(hwndDlg, IDC_LST_CONTACTS); SendMessage(hwnd,LVM_SETEXTENDEDLISTVIEWSTYLE, 0,LVS_EX_FULLROWSELECT); // Set style // Create list columns ZeroMemory(&LvCol, sizeof(LvCol)); LvCol.mask=LVCF_TEXT|LVCF_WIDTH|LVCF_SUBITEM; // Type of mask // Inserting Couloms as much as we want LvCol.pszText=Translate("Contact"); // First Header Text LvCol.cx=100; // width of column SendMessage(hwnd,LVM_INSERTCOLUMN,0,(LPARAM)&LvCol); // Insert/Show the coloum LvCol.pszText=Translate("Id"); // Next coloum LvCol.cx=130; // width of column SendMessage(hwnd,LVM_INSERTCOLUMN,1,(LPARAM)&LvCol); // ... LvCol.pszText=Translate("Protocol"); // LvCol.cx=100; // width of column SendMessage(hwnd,LVM_INSERTCOLUMN,2,(LPARAM)&LvCol); // LvCol.pszText=Translate("Default"); // LvCol.cx=60; // width of column SendMessage(hwnd,LVM_INSERTCOLUMN,3,(LPARAM)&LvCol); // LvCol.pszText=Translate("Send Offline"); // LvCol.cx=85; // width of column SendMessage(hwnd,LVM_INSERTCOLUMN,4,(LPARAM)&LvCol); // // disable buttons until a selection is made in the list hwnd = GetDlgItem(hwndDlg, IDC_BTN_REM); EnableWindow(hwnd, FALSE); hwnd = GetDlgItem(hwndDlg, IDC_BTN_SETDEFAULT); EnableWindow(hwnd, FALSE); hwnd = GetDlgItem(hwndDlg, IDC_BTN_SETOFFLINE); EnableWindow(hwnd, FALSE); hwnd = GetDlgItem(hwndDlg, IDC_BTN_UP); EnableWindow(hwnd, FALSE); hwnd = GetDlgItem(hwndDlg, IDC_BTN_DOWN); EnableWindow(hwnd, FALSE); nb_contacts = DBGetContactSettingDword((HANDLE)lParam, META_PROTO, "NumContacts", 0); default_contact_number = DBGetContactSettingDword((HANDLE)lParam, META_PROTO, "Default", (DWORD)-1); offline_contact_number = DBGetContactSettingDword((HANDLE)lParam, META_PROTO, "OfflineSend", (DWORD)-1); changes.hMeta = (HANDLE)lParam; changes.num_contacts = nb_contacts; changes.num_deleted = 0; changes.hDefaultContact = Meta_GetContactHandle((HANDLE)lParam, default_contact_number); changes.hOfflineContact = Meta_GetContactHandle((HANDLE)lParam, offline_contact_number); for(i = 0; i < nb_contacts; i++) changes.hContact[i] = Meta_GetContactHandle((HANDLE)lParam, i); changes.force_default = MetaAPI_GetForceState((WPARAM)lParam, 0); SendMessage(hwndDlg, WMU_SETTITLE, 0, lParam); CheckDlgButton(hwndDlg, IDC_CHK_FORCEDEFAULT, changes.force_default); FillContactList(hwndDlg, &changes); return TRUE; } case WMU_SETTITLE: { char *szCDN = (char *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)lParam, 0); if(os_unicode_enabled) { wchar_t *swzCDN = (wchar_t *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)lParam, GCDNF_UNICODE), *swzContactDisplayName; // detect if the clist provided unicode display name by comparing with non-unicode if(szCDN && swzCDN && strncmp(szCDN, (char *)swzCDN, strlen(szCDN)) != 0 && wcslen(swzCDN) >= strlen(szCDN)) { swzContactDisplayName = swzCDN; } else { // no? convert to unicode if(szCDN) { swzContactDisplayName = (wchar_t *) _malloca(sizeof(wchar_t) * (strlen(szCDN) + 1)); MultiByteToWideChar(CP_ACP, 0, (char *) szCDN, -1, swzContactDisplayName, (int)strlen((char *)szCDN) + 1); } else { swzContactDisplayName = TranslateW(L"(Unknown Contact)"); } } SetWindowTextW(GetDlgItem(hwndDlg,IDC_ED_NAME), swzContactDisplayName); } else { SetWindowText(GetDlgItem(hwndDlg,IDC_ED_NAME), szCDN); } } return TRUE; case WM_NOTIFY: // the message that is being sent always switch(LOWORD(wParam)) // hit control { case IDC_LST_CONTACTS: // did we hit our ListView contorl? if(((LPNMHDR)lParam)->code == NM_CLICK) { hwnd = GetDlgItem(hwndDlg, IDC_LST_CONTACTS); sel=SendMessage(hwnd,LVM_GETNEXTITEM,-1,LVNI_FOCUSED|LVNI_SELECTED); // return item selected // enable buttons hwnd = GetDlgItem(hwndDlg, IDC_BTN_REM); EnableWindow(hwnd, sel!=-1); hwnd = GetDlgItem(hwndDlg, IDC_BTN_SETDEFAULT); EnableWindow(hwnd, sel!=-1 && changes.hContact[sel] != changes.hDefaultContact); hwnd = GetDlgItem(hwndDlg, IDC_BTN_SETOFFLINE); EnableWindow(hwnd, sel!=-1 && changes.hContact[sel] != changes.hOfflineContact); hwnd = GetDlgItem(hwndDlg, IDC_BTN_UP); EnableWindow(hwnd, (sel > 0)); hwnd = GetDlgItem(hwndDlg, IDC_BTN_DOWN); EnableWindow(hwnd, (sel != -1) && (sel < changes.num_contacts - 1)); /* // custom draw stuff - change colour of listview things - doesn't affect selection :( } else if(((LPNMHDR)lParam)->code == NM_CUSTOMDRAW) { SetWindowLong(hwndDlg, DWL_MSGRESULT, (LONG)ProcessCustomDraw(lParam)); return TRUE; */ } break; } break; case WM_COMMAND: switch(HIWORD(wParam)) { case BN_CLICKED: // A button ('Remove', 'Ok', 'Cancel' or 'Apply', normally) has been clicked switch(LOWORD(wParam)) { case IDC_VALIDATE: // Apply changes, if there is still one contact attached to the metacontact. if(changes.num_contacts == 0) // Otherwise, delete the metacontact. { if(MessageBox(hwndDlg,Translate("You are going to remove all the contacts associated with this MetaContact.\nThis will delete the MetaContact.\n\nProceed Anyway?"), Translate("Delete MetaContact?"),MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON1)!=IDYES) return TRUE; else { Meta_Delete((WPARAM)changes.hMeta,(LPARAM)NULL); DestroyWindow(hwndDlg); return TRUE; } } ApplyChanges(&changes); // Disable the 'Apply' button. EnableWindow(GetDlgItem(hwndDlg,IDC_VALIDATE),FALSE); break; case IDOK: if(IsWindowEnabled(GetDlgItem(hwndDlg,IDC_VALIDATE))) { // If there are changes that could be made, if(changes.num_contacts == 0) // do the work that would have be done if { // the button 'Apply' has been clicked. if(MessageBox(hwndDlg,Translate("You are going to remove all the contacts associated with this MetaContact.\nThis will delete the MetaContact.\n\nProceed Anyway?"), Translate("Delete MetaContact?"),MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON1)!=IDYES) { return TRUE; } else { Meta_Delete((WPARAM)changes.hMeta,(LPARAM)NULL); DestroyWindow(hwndDlg); return TRUE; } } ApplyChanges(&changes); } EndDialog(hwndDlg, IDOK); return TRUE; case IDCANCEL: // Simply close the dialog EndDialog(hwndDlg, IDCANCEL); return TRUE; case IDC_BTN_SETDEFAULT: hwnd = GetDlgItem(hwndDlg, IDC_LST_CONTACTS); sel=SendMessage(hwnd,LVM_GETNEXTITEM,-1,LVNI_FOCUSED|LVNI_SELECTED); // return item selected InvalidateRect(hwnd, 0, TRUE); changes.hDefaultContact = changes.hContact[sel]; SendMessage(hwndDlg, WMU_SETTITLE, 0, (LPARAM)changes.hContact[sel]); FillContactList(hwndDlg, &changes); SetListSelection(hwnd, sel); // Disable set default button EnableWindow(GetDlgItem(hwndDlg,IDC_BTN_SETDEFAULT),FALSE); // Enable the 'Apply' button. EnableWindow(GetDlgItem(hwndDlg,IDC_VALIDATE),TRUE); // repaint list return TRUE; case IDC_BTN_SETOFFLINE: hwnd = GetDlgItem(hwndDlg, IDC_LST_CONTACTS); sel=SendMessage(hwnd,LVM_GETNEXTITEM,-1,LVNI_FOCUSED|LVNI_SELECTED); // return item selected InvalidateRect(hwnd, 0, TRUE); changes.hOfflineContact = changes.hContact[sel]; FillContactList(hwndDlg, &changes); SetListSelection(hwnd, sel); // Disable set offline button EnableWindow(GetDlgItem(hwndDlg,IDC_BTN_SETOFFLINE),FALSE); // Enable the 'Apply' button. EnableWindow(GetDlgItem(hwndDlg,IDC_VALIDATE),TRUE); // repaint list return TRUE; case IDC_BTN_REM: hwnd = GetDlgItem(hwndDlg, IDC_LST_CONTACTS); sel=SendMessage(hwnd,LVM_GETNEXTITEM,-1,LVNI_FOCUSED|LVNI_SELECTED); // return item selected changes.num_contacts--; changes.hDeletedContacts[changes.num_deleted++] = changes.hContact[sel]; if(changes.hDefaultContact == changes.hContact[sel]) { if(changes.num_contacts > 0) { changes.hDefaultContact = changes.hContact[0]; str = (char *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)changes.hDefaultContact, 0); SetWindowText(GetDlgItem(hwndDlg,IDC_ED_DEFAULT),str); } else { changes.hDefaultContact = 0; SetWindowText(GetDlgItem(hwndDlg,IDC_ED_DEFAULT),"None"); } } for(i = sel; i < changes.num_contacts; i++) changes.hContact[i] = changes.hContact[i + 1]; FillContactList(hwndDlg, &changes); // disable buttons hwnd = GetDlgItem(hwndDlg, IDC_BTN_REM); EnableWindow(hwnd, FALSE); hwnd = GetDlgItem(hwndDlg, IDC_BTN_SETDEFAULT); EnableWindow(hwnd, FALSE); hwnd = GetDlgItem(hwndDlg, IDC_BTN_SETOFFLINE); EnableWindow(hwnd, FALSE); hwnd = GetDlgItem(hwndDlg, IDC_BTN_UP); EnableWindow(hwnd, FALSE); hwnd = GetDlgItem(hwndDlg, IDC_BTN_DOWN); EnableWindow(hwnd, FALSE); // Enable the 'Apply' button. EnableWindow(GetDlgItem(hwndDlg,IDC_VALIDATE),TRUE); return TRUE; case IDC_BTN_UP: hwnd = GetDlgItem(hwndDlg, IDC_LST_CONTACTS); sel=SendMessage(hwnd,LVM_GETNEXTITEM,-1,LVNI_FOCUSED|LVNI_SELECTED); // return item selected { HANDLE temp = changes.hContact[sel]; changes.hContact[sel] = changes.hContact[sel - 1]; changes.hContact[sel - 1] = temp; } FillContactList(hwndDlg, &changes); sel--; SetListSelection(hwnd, sel); hwnd = GetDlgItem(hwndDlg, IDC_BTN_UP); EnableWindow(hwnd, (sel > 0)); hwnd = GetDlgItem(hwndDlg, IDC_BTN_DOWN); EnableWindow(hwnd, (sel < changes.num_contacts - 1)); // Enable the 'Apply' button. EnableWindow(GetDlgItem(hwndDlg,IDC_VALIDATE),TRUE); return TRUE; case IDC_BTN_DOWN: hwnd = GetDlgItem(hwndDlg, IDC_LST_CONTACTS); sel=SendMessage(hwnd,LVM_GETNEXTITEM,-1,LVNI_FOCUSED|LVNI_SELECTED); // return item selected { HANDLE temp = changes.hContact[sel]; changes.hContact[sel] = changes.hContact[sel + 1]; changes.hContact[sel + 1] = temp; } FillContactList(hwndDlg, &changes); sel++; SetListSelection(hwnd, sel); hwnd = GetDlgItem(hwndDlg, IDC_BTN_UP); EnableWindow(hwnd, (sel > 0)); hwnd = GetDlgItem(hwndDlg, IDC_BTN_DOWN); EnableWindow(hwnd, (sel < changes.num_contacts - 1)); // Enable the 'Apply' button. EnableWindow(GetDlgItem(hwndDlg,IDC_VALIDATE),TRUE); return TRUE; case IDC_CHK_FORCEDEFAULT: changes.force_default = IsDlgButtonChecked(hwndDlg, IDC_CHK_FORCEDEFAULT); // Enable the 'Apply' button. EnableWindow(GetDlgItem(hwndDlg,IDC_VALIDATE),TRUE); return TRUE; } } break; case WM_CLOSE: DestroyWindow(hwndDlg); return TRUE; case WM_DESTROY: ReleaseIconEx((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, 0)); EndDialog(hwndDlg, IDCANCEL); break; } return FALSE; }
void LoadLogIcons(void) { hIcons[ICON_ACTION] = LoadIconEx( "log_action", FALSE ); hIcons[ICON_ADDSTATUS] = LoadIconEx( "log_addstatus", FALSE ); hIcons[ICON_HIGHLIGHT] = LoadIconEx( "log_highlight", FALSE ); hIcons[ICON_INFO] = LoadIconEx( "log_info", FALSE ); hIcons[ICON_JOIN] = LoadIconEx( "log_join", FALSE ); hIcons[ICON_KICK] = LoadIconEx( "log_kick", FALSE ); hIcons[ICON_MESSAGE] = LoadIconEx( "log_message_in", FALSE ); hIcons[ICON_MESSAGEOUT] = LoadIconEx( "log_message_out", FALSE ); hIcons[ICON_NICK] = LoadIconEx( "log_nick", FALSE ); hIcons[ICON_NOTICE] = LoadIconEx( "log_notice", FALSE ); hIcons[ICON_PART] = LoadIconEx( "log_part", FALSE ); hIcons[ICON_QUIT] = LoadIconEx( "log_quit", FALSE ); hIcons[ICON_REMSTATUS] = LoadIconEx( "log_removestatus", FALSE ); hIcons[ICON_TOPIC] = LoadIconEx( "log_topic", FALSE ); hIcons[ICON_STATUS1] = LoadIconEx( "status1", FALSE ); hIcons[ICON_STATUS2] = LoadIconEx( "status2", FALSE ); hIcons[ICON_STATUS3] = LoadIconEx( "status3", FALSE ); hIcons[ICON_STATUS4] = LoadIconEx( "status4", FALSE ); hIcons[ICON_STATUS0] = LoadIconEx( "status0", FALSE ); hIcons[ICON_STATUS5] = LoadIconEx( "status5", FALSE ); }
void LoadLogIcons(void) { ZeroMemory(hIcons, sizeof(HICON) * (ICON_STATUS5 - ICON_ACTION)); hIcons[ICON_ACTION] = LoadIconEx(IDI_ACTION, "log_action", 16, 16); hIcons[ICON_ADDSTATUS] = LoadIconEx(IDI_ADDSTATUS, "log_addstatus", 16, 16); hIcons[ICON_HIGHLIGHT] = LoadIconEx(IDI_HIGHLIGHT, "log_highlight", 16, 16); hIcons[ICON_INFO] = LoadIconEx(IDI_INFO, "log_info", 16, 16); hIcons[ICON_JOIN] = LoadIconEx(IDI_JOIN, "log_join", 16, 16); hIcons[ICON_KICK] = LoadIconEx(IDI_KICK, "log_kick", 16, 16); hIcons[ICON_MESSAGE] = LoadIconEx(IDI_MESSAGE, "log_message_in", 16, 16); hIcons[ICON_MESSAGEOUT] = LoadIconEx(IDI_MESSAGEOUT, "log_message_out", 16, 16); hIcons[ICON_NICK] = LoadIconEx(IDI_NICK, "log_nick", 16, 16); hIcons[ICON_NOTICE] = LoadIconEx(IDI_NOTICE, "log_notice", 16, 16); hIcons[ICON_PART] = LoadIconEx(IDI_PART, "log_part", 16, 16); hIcons[ICON_QUIT] = LoadIconEx(IDI_QUIT, "log_quit", 16, 16); hIcons[ICON_REMSTATUS] = LoadIconEx(IDI_REMSTATUS, "log_removestatus", 16, 16); hIcons[ICON_TOPIC] = LoadIconEx(IDI_TOPIC, "log_topic", 16, 16); hIcons[ICON_STATUS1] = LoadIconEx(IDI_STATUS1, "status1", 16, 16); hIcons[ICON_STATUS2] = LoadIconEx(IDI_STATUS2, "status2", 16, 16); hIcons[ICON_STATUS3] = LoadIconEx(IDI_STATUS3, "status3", 16, 16); hIcons[ICON_STATUS4] = LoadIconEx(IDI_STATUS4, "status4", 16, 16); hIcons[ICON_STATUS0] = LoadIconEx(IDI_STATUS0, "status0", 16, 16); hIcons[ICON_STATUS5] = LoadIconEx(IDI_STATUS5, "status5", 16, 16); return; }
INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { static bool bDlgInit = false; // some controls send WM_COMMAND before or during WM_INITDIALOG static OPTTREE_OPTION *statusOptions = NULL; static int statusOptionsCount = 0; if (statusOptions) { int index; if (OptTree_ProcessMessage(hwnd, msg, wParam, lParam, &index, IDC_STATUSES, statusOptions, statusOptionsCount)) return TRUE; } switch (msg) { case WM_INITDIALOG: // Seconds of delay CheckDlgButton(hwnd, IDC_INFINITEDELAY, PopupOptions.InfiniteDelay ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwnd, IDC_LEAVEHOVERED, PopupOptions.LeaveHovered ? BST_CHECKED : BST_UNCHECKED); EnableWindow(GetDlgItem(hwnd, IDC_SECONDS), !PopupOptions.InfiniteDelay); EnableWindow(GetDlgItem(hwnd, IDC_SECONDS_STATIC1), !PopupOptions.InfiniteDelay); EnableWindow(GetDlgItem(hwnd, IDC_SECONDS_STATIC2), !PopupOptions.InfiniteDelay); EnableWindow(GetDlgItem(hwnd, IDC_LEAVEHOVERED), !PopupOptions.InfiniteDelay); SetDlgItemInt(hwnd, IDC_SECONDS, PopupOptions.Seconds, FALSE); SendDlgItemMessage(hwnd, IDC_SECONDS_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(SETTING_LIFETIME_MAX, SETTING_LIFETIME_MIN)); // Dynamic Resize CheckDlgButton(hwnd, IDC_DYNAMICRESIZE, PopupOptions.DynamicResize ? BST_CHECKED : BST_UNCHECKED); SetDlgItemText(hwnd, IDC_USEMAXIMUMWIDTH, PopupOptions.DynamicResize ? LPGENT("Maximum width") : LPGENT("Width")); // Minimum Width CheckDlgButton(hwnd, IDC_USEMINIMUMWIDTH, PopupOptions.UseMinimumWidth ? BST_CHECKED : BST_UNCHECKED); SendDlgItemMessage(hwnd, IDC_MINIMUMWIDTH_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(SETTING_MAXIMUMWIDTH_MAX, SETTING_MINIMUMWIDTH_MIN)); SetDlgItemInt(hwnd, IDC_MINIMUMWIDTH, PopupOptions.MinimumWidth, FALSE); // Maximum Width PopupOptions.UseMaximumWidth = PopupOptions.DynamicResize ? PopupOptions.UseMaximumWidth : TRUE; CheckDlgButton(hwnd, IDC_USEMAXIMUMWIDTH, PopupOptions.UseMaximumWidth ? BST_CHECKED : BST_UNCHECKED); SendDlgItemMessage(hwnd, IDC_MAXIMUMWIDTH_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(SETTING_MAXIMUMWIDTH_MAX, SETTING_MINIMUMWIDTH_MIN)); SetDlgItemInt(hwnd, IDC_MAXIMUMWIDTH, PopupOptions.MaximumWidth, FALSE); // And finally let's enable/disable them. EnableWindow(GetDlgItem(hwnd, IDC_USEMINIMUMWIDTH), PopupOptions.DynamicResize); EnableWindow(GetDlgItem(hwnd, IDC_MINIMUMWIDTH), PopupOptions.DynamicResize && PopupOptions.UseMinimumWidth); EnableWindow(GetDlgItem(hwnd, IDC_MINIMUMWIDTH_SPIN), PopupOptions.DynamicResize && PopupOptions.UseMinimumWidth); EnableWindow(GetDlgItem(hwnd, IDC_MAXIMUMWIDTH), PopupOptions.UseMaximumWidth); EnableWindow(GetDlgItem(hwnd, IDC_MAXIMUMWIDTH_SPIN), PopupOptions.UseMaximumWidth); // Position combobox. { HWND hCtrl = GetDlgItem(hwnd, IDC_WHERE); ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("Upper left corner")), POS_UPPERLEFT); ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("Lower left corner")), POS_LOWERLEFT); ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("Lower right corner")), POS_LOWERRIGHT); ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("Upper right corner")), POS_UPPERRIGHT); SendDlgItemMessage(hwnd, IDC_WHERE, CB_SETCURSEL, PopupOptions.Position, 0); } // Configure popup area { HWND hCtrl = GetDlgItem(hwnd, IDC_CUSTOMPOS); SendMessage(hCtrl, BUTTONSETASFLATBTN, TRUE, 0); SendMessage(hCtrl, BUTTONADDTOOLTIP, (WPARAM)_T("Popup area"), BATF_TCHAR); SendMessage(hCtrl, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx(IDI_RESIZE)); } // Spreading combobox { HWND hCtrl = GetDlgItem(hwnd, IDC_LAYOUT); ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("Horizontal")), SPREADING_HORIZONTAL); ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("Vertical")), SPREADING_VERTICAL); SendDlgItemMessage(hwnd, IDC_LAYOUT, CB_SETCURSEL, PopupOptions.Spreading, 0); } // miscellaneous CheckDlgButton(hwnd, IDC_REORDERPOPUPS, PopupOptions.ReorderPopups ? BST_CHECKED : BST_UNCHECKED); // Popup enabled CheckDlgButton(hwnd, IDC_POPUPENABLED, PopupOptions.ModuleIsEnabled ? BST_UNCHECKED : BST_CHECKED); CheckDlgButton(hwnd, IDC_DISABLEINFS, PopupOptions.DisableWhenFullscreen ? BST_CHECKED : BST_UNCHECKED); EnableWindow(GetDlgItem(hwnd, IDC_DISABLEINFS), PopupOptions.ModuleIsEnabled); EnableWindow(GetDlgItem(hwnd, IDC_STATUSES), PopupOptions.ModuleIsEnabled); // new status options { int protocolCount = 0; PROTOACCOUNT **protocols; Proto_EnumAccounts(&protocolCount, &protocols); DWORD globalFlags = 0; for (int i = 0; i < protocolCount; ++i) { if (!protocols[i]->bIsVirtual) { DWORD protoFlags = CallProtoService(protocols[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0); globalFlags |= protoFlags; statusOptionsCount += CountStatusModes(protoFlags); } } statusOptionsCount += CountStatusModes(globalFlags); statusOptions = new OPTTREE_OPTION[statusOptionsCount]; int pos = AddStatusModes(statusOptions, 0, LPGENT("Global Status"), globalFlags); for (int i = 0; i < protocolCount; ++i) { if (!protocols[i]->bIsVirtual) { DWORD protoFlags = CallProtoService(protocols[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0); if (!CountStatusModes(protoFlags)) continue; TCHAR prefix[128]; mir_sntprintf(prefix, _countof(prefix), LPGENT("Protocol Status")_T("/%s"), protocols[i]->tszAccountName); pos = AddStatusModes(statusOptions, pos, prefix, protoFlags); } } int index; OptTree_ProcessMessage(hwnd, msg, wParam, lParam, &index, IDC_STATUSES, statusOptions, statusOptionsCount); for (int i = 0; i < protocolCount; ++i) { if (!protocols[i]->bIsVirtual) { DWORD protoFlags = CallProtoService(protocols[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0); if (!CountStatusModes(protoFlags)) continue; char prefix[128]; mir_snprintf(prefix, _countof(prefix), "Protocol Status/%s", protocols[i]->szModuleName); TCHAR pszSettingName[256]; mir_sntprintf(pszSettingName, _countof(pszSettingName), LPGENT("Protocol Status")_T("/%s"), protocols[i]->tszAccountName); OptTree_SetOptions(hwnd, IDC_STATUSES, statusOptions, statusOptionsCount, db_get_dw(NULL, MODULNAME, prefix, 0), pszSettingName); } } OptTree_SetOptions(hwnd, IDC_STATUSES, statusOptions, statusOptionsCount, db_get_dw(NULL, MODULNAME, "Global Status", 0), LPGENT("Global Status")); } TranslateDialogDefault(hwnd); // do it on end of WM_INITDIALOG bDlgInit = true; return TRUE; case WM_COMMAND: switch (HIWORD(wParam)) { case BN_CLICKED: // Button controls switch (LOWORD(wParam)) { case IDC_INFINITEDELAY: PopupOptions.InfiniteDelay = !PopupOptions.InfiniteDelay; EnableWindow(GetDlgItem(hwnd, IDC_SECONDS), !PopupOptions.InfiniteDelay); EnableWindow(GetDlgItem(hwnd, IDC_SECONDS_STATIC1), !PopupOptions.InfiniteDelay); EnableWindow(GetDlgItem(hwnd, IDC_SECONDS_STATIC2), !PopupOptions.InfiniteDelay); EnableWindow(GetDlgItem(hwnd, IDC_LEAVEHOVERED), !PopupOptions.InfiniteDelay); SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); break; case IDC_LEAVEHOVERED: PopupOptions.LeaveHovered = !PopupOptions.LeaveHovered; SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); break; case IDC_DYNAMICRESIZE: PopupOptions.DynamicResize = !PopupOptions.DynamicResize; EnableWindow(GetDlgItem(hwnd, IDC_USEMINIMUMWIDTH), PopupOptions.DynamicResize); EnableWindow(GetDlgItem(hwnd, IDC_MINIMUMWIDTH), PopupOptions.DynamicResize && PopupOptions.UseMinimumWidth); EnableWindow(GetDlgItem(hwnd, IDC_MINIMUMWIDTH_SPIN), PopupOptions.DynamicResize && PopupOptions.UseMinimumWidth); SetDlgItemText(hwnd, IDC_USEMAXIMUMWIDTH, PopupOptions.DynamicResize ? TranslateT("Maximum width") : TranslateT("Width")); if (!PopupOptions.DynamicResize) { PopupOptions.UseMaximumWidth = TRUE; CheckDlgButton(hwnd, IDC_USEMAXIMUMWIDTH, BST_CHECKED); EnableWindow(GetDlgItem(hwnd, IDC_USEMAXIMUMWIDTH), TRUE); EnableWindow(GetDlgItem(hwnd, IDC_MAXIMUMWIDTH), TRUE); EnableWindow(GetDlgItem(hwnd, IDC_MAXIMUMWIDTH_SPIN), TRUE); } SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); break; case IDC_USEMINIMUMWIDTH: PopupOptions.UseMinimumWidth = !PopupOptions.UseMinimumWidth; EnableWindow(GetDlgItem(hwnd, IDC_MINIMUMWIDTH), PopupOptions.UseMinimumWidth); EnableWindow(GetDlgItem(hwnd, IDC_MINIMUMWIDTH_SPIN), PopupOptions.UseMinimumWidth); SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); break; case IDC_USEMAXIMUMWIDTH: PopupOptions.UseMaximumWidth = Button_GetCheck((HWND)lParam); if (!PopupOptions.DynamicResize) { // ugly - set always on if DynamicResize = off CheckDlgButton(hwnd, LOWORD(wParam), BST_CHECKED); PopupOptions.UseMaximumWidth = TRUE; } EnableWindow(GetDlgItem(hwnd, IDC_MAXIMUMWIDTH), PopupOptions.UseMaximumWidth); EnableWindow(GetDlgItem(hwnd, IDC_MAXIMUMWIDTH_SPIN), PopupOptions.UseMaximumWidth); SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); break; case IDC_CUSTOMPOS: { RECT rcButton, rcBox; HWND hwndBox = CreateDialog(hInst, MAKEINTRESOURCE(IDD_POSITION), NULL, PositionBoxDlgProc); GetWindowRect((HWND)lParam, &rcButton); GetWindowRect(hwndBox, &rcBox); MoveWindow(hwndBox, rcButton.right - (rcBox.right - rcBox.left) + 15, rcButton.bottom + 3, rcBox.right - rcBox.left, rcBox.bottom - rcBox.top, FALSE); SetWindowLongPtr(hwndBox, GWL_EXSTYLE, GetWindowLongPtr(hwndBox, GWL_EXSTYLE) | WS_EX_LAYERED); SetLayeredWindowAttributes(hwndBox, NULL, 0, LWA_ALPHA); ShowWindow(hwndBox, SW_SHOW); for (int i = 0; i <= 255; i += 15) { SetLayeredWindowAttributes(hwndBox, NULL, i, LWA_ALPHA); UpdateWindow(hwndBox); Sleep(1); } SetWindowLongPtr(hwndBox, GWL_EXSTYLE, GetWindowLongPtr(hwndBox, GWL_EXSTYLE) & ~WS_EX_LAYERED); ShowWindow(hwndBox, SW_SHOW); SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); } break; case IDC_REORDERPOPUPS: { PopupOptions.ReorderPopups = !PopupOptions.ReorderPopups; PopupOptions.ReorderPopupsWarning = PopupOptions.ReorderPopups ? db_get_b(NULL, MODULNAME, "ReorderPopupsWarning", TRUE) : TRUE; SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); } break; case IDC_POPUPENABLED: { int chk = IsDlgButtonChecked(hwnd, IDC_POPUPENABLED); if (PopupOptions.ModuleIsEnabled&&chk || !PopupOptions.ModuleIsEnabled && !chk) svcEnableDisableMenuCommand(0, 0); EnableWindow(GetDlgItem(hwnd, IDC_STATUSES), PopupOptions.ModuleIsEnabled); EnableWindow(GetDlgItem(hwnd, IDC_DISABLEINFS), PopupOptions.ModuleIsEnabled); } break; case IDC_DISABLEINFS: PopupOptions.DisableWhenFullscreen = !PopupOptions.DisableWhenFullscreen; SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); break; case IDC_PREVIEW: PopupPreview(); break; } break; case CBN_SELCHANGE: // ComboBox controls switch (LOWORD(wParam)) { // lParam = Handle to the control case IDC_WHERE: PopupOptions.Position = ComboBox_GetItemData((HWND)lParam, ComboBox_GetCurSel((HWND)lParam)); SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); break; case IDC_LAYOUT: PopupOptions.Spreading = ComboBox_GetItemData((HWND)lParam, ComboBox_GetCurSel((HWND)lParam)); SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); break; } break; case EN_CHANGE: // Edit controls change if (!bDlgInit) break; switch (LOWORD(wParam)) { // lParam = Handle to the control case IDC_SECONDS: { int seconds = GetDlgItemInt(hwnd, LOWORD(wParam), NULL, FALSE); if (seconds >= SETTING_LIFETIME_MIN && seconds <= SETTING_LIFETIME_MAX && seconds != PopupOptions.Seconds) { PopupOptions.Seconds = seconds; SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); } } break; case IDC_MINIMUMWIDTH: { int temp = GetDlgItemInt(hwnd, IDC_MINIMUMWIDTH, NULL, FALSE); if (temp >= SETTING_MINIMUMWIDTH_MIN && temp <= SETTING_MAXIMUMWIDTH_MAX && temp != PopupOptions.MinimumWidth) { PopupOptions.MinimumWidth = temp; SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); } } break; case IDC_MAXIMUMWIDTH: { int temp = GetDlgItemInt(hwnd, IDC_MAXIMUMWIDTH, NULL, FALSE); if (temp >= SETTING_MINIMUMWIDTH_MIN && temp <= SETTING_MAXIMUMWIDTH_MAX && temp != PopupOptions.MaximumWidth) { PopupOptions.MaximumWidth = temp; SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); } } break; }// end switch(idCtrl) break; case EN_KILLFOCUS: // Edit controls lost fokus switch (LOWORD(wParam)) { // lParam = Handle to the control case IDC_SECONDS: { int seconds = GetDlgItemInt(hwnd, LOWORD(wParam), NULL, FALSE); if (seconds > SETTING_LIFETIME_MAX) PopupOptions.Seconds = SETTING_LIFETIME_MAX; else if (seconds < SETTING_LIFETIME_MIN) PopupOptions.Seconds = SETTING_LIFETIME_MIN; if (seconds != PopupOptions.Seconds) { SetDlgItemInt(hwnd, LOWORD(wParam), PopupOptions.Seconds, FALSE); ErrorMSG(SETTING_LIFETIME_MIN, SETTING_LIFETIME_MAX); SetFocus((HWND)lParam); } } break; case IDC_MINIMUMWIDTH: { int temp = GetDlgItemInt(hwnd, LOWORD(wParam), NULL, FALSE); if (temp < SETTING_MINIMUMWIDTH_MIN) PopupOptions.MinimumWidth = SETTING_MINIMUMWIDTH_MIN; else if (temp > SETTING_MAXIMUMWIDTH_MAX) PopupOptions.MinimumWidth = SETTING_MAXIMUMWIDTH_MAX; if (temp != PopupOptions.MinimumWidth) { SetDlgItemInt(hwnd, LOWORD(wParam), PopupOptions.MinimumWidth, FALSE); ErrorMSG(SETTING_MINIMUMWIDTH_MIN, SETTING_MAXIMUMWIDTH_MAX); SetFocus((HWND)lParam); break; } if (temp > PopupOptions.MaximumWidth) { PopupOptions.MaximumWidth = min(temp, SETTING_MAXIMUMWIDTH_MAX); SetDlgItemInt(hwnd, IDC_MAXIMUMWIDTH, PopupOptions.MaximumWidth, FALSE); } } break; case IDC_MAXIMUMWIDTH: { int temp = GetDlgItemInt(hwnd, LOWORD(wParam), NULL, FALSE); if (temp >= SETTING_MAXIMUMWIDTH_MAX) PopupOptions.MaximumWidth = SETTING_MAXIMUMWIDTH_MAX; else if (temp < SETTING_MINIMUMWIDTH_MIN) PopupOptions.MaximumWidth = SETTING_MINIMUMWIDTH_MIN; if (temp != PopupOptions.MaximumWidth) { SetDlgItemInt(hwnd, LOWORD(wParam), PopupOptions.MaximumWidth, FALSE); ErrorMSG(SETTING_MINIMUMWIDTH_MIN, SETTING_MAXIMUMWIDTH_MAX); SetFocus((HWND)lParam); break; } if (temp < PopupOptions.MinimumWidth) { PopupOptions.MinimumWidth = max(temp, SETTING_MINIMUMWIDTH_MIN); SetDlgItemInt(hwnd, IDC_MINIMUMWIDTH, PopupOptions.MinimumWidth, FALSE); } } break; } break; } break; case WM_NOTIFY: switch (((LPNMHDR)lParam)->idFrom) { case 0: switch (((LPNMHDR)lParam)->code) { case PSN_RESET: LoadOption_General(); return TRUE; case PSN_APPLY: // Seconds db_set_b(NULL, MODULNAME, "InfiniteDelay", PopupOptions.InfiniteDelay); db_set_w(NULL, MODULNAME, "Seconds", (WORD)PopupOptions.Seconds); db_set_b(NULL, MODULNAME, "LeaveHovered", PopupOptions.LeaveHovered); // Dynamic Resize db_set_b(NULL, MODULNAME, "DynamicResize", PopupOptions.DynamicResize); db_set_b(NULL, MODULNAME, "UseMinimumWidth", PopupOptions.UseMinimumWidth); db_set_w(NULL, MODULNAME, "MinimumWidth", PopupOptions.MinimumWidth); db_set_b(NULL, MODULNAME, "UseMaximumWidth", PopupOptions.UseMaximumWidth); db_set_w(NULL, MODULNAME, "MaximumWidth", PopupOptions.MaximumWidth); // Position db_set_b(NULL, MODULNAME, "Position", (BYTE)PopupOptions.Position); // Configure popup area db_set_w(NULL, MODULNAME, "gapTop", (WORD)PopupOptions.gapTop); db_set_w(NULL, MODULNAME, "gapBottom", (WORD)PopupOptions.gapBottom); db_set_w(NULL, MODULNAME, "gapLeft", (WORD)PopupOptions.gapLeft); db_set_w(NULL, MODULNAME, "gapRight", (WORD)PopupOptions.gapRight); db_set_w(NULL, MODULNAME, "spacing", (WORD)PopupOptions.spacing); // Spreading db_set_b(NULL, MODULNAME, "Spreading", (BYTE)PopupOptions.Spreading); // miscellaneous Check_ReorderPopups(hwnd); // this save also PopupOptions.ReorderPopups // disable When db_set_b(NULL, MODULNAME, "DisableWhenFullscreen", PopupOptions.DisableWhenFullscreen); // new status options { int protocolCount; PROTOACCOUNT **protocols; Proto_EnumAccounts(&protocolCount, &protocols); for (int i = 0; i < protocolCount; ++i) { if (!protocols[i]->bIsVirtual) { char prefix[128]; mir_snprintf(prefix, _countof(prefix), "Protocol Status/%s", protocols[i]->szModuleName); TCHAR pszSettingName[256]; mir_sntprintf(pszSettingName, _countof(pszSettingName), _T("Protocol Status/%s"), protocols[i]->tszAccountName); db_set_dw(NULL, MODULNAME, prefix, OptTree_GetOptions(hwnd, IDC_STATUSES, statusOptions, statusOptionsCount, pszSettingName)); } } db_set_dw(NULL, MODULNAME, "Global Status", OptTree_GetOptions(hwnd, IDC_STATUSES, statusOptions, statusOptionsCount, _T("Global Status"))); } return TRUE; } break; case IDC_MINIMUMWIDTH_SPIN: { LPNMUPDOWN lpnmud = (LPNMUPDOWN)lParam; int temp = lpnmud->iPos + lpnmud->iDelta; if (temp > PopupOptions.MaximumWidth) { PopupOptions.MaximumWidth = min(temp, SETTING_MAXIMUMWIDTH_MAX); SetDlgItemInt(hwnd, IDC_MAXIMUMWIDTH, PopupOptions.MaximumWidth, FALSE); } } break; case IDC_MAXIMUMWIDTH_SPIN: { LPNMUPDOWN lpnmud = (LPNMUPDOWN)lParam; int temp = lpnmud->iPos + lpnmud->iDelta; if (temp < PopupOptions.MinimumWidth) { PopupOptions.MinimumWidth = max(temp, SETTING_MINIMUMWIDTH_MIN); SetDlgItemInt(hwnd, IDC_MINIMUMWIDTH, PopupOptions.MinimumWidth, FALSE); } } } break; case WM_DESTROY: if (statusOptions) { for (int i = 0; i < statusOptionsCount; ++i) { mir_free(statusOptions[i].pszOptionName); mir_free(statusOptions[i].pszSettingName); } delete[] statusOptions; statusOptions = NULL; statusOptionsCount = 0; bDlgInit = false; } break; } return FALSE; }
INT_PTR CALLBACK DlgProcSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); // make the buttons flat SendMessage(GetDlgItem(hwndDlg,IDC_STEP1), BUTTONSETASFLATBTN, TRUE, 0); SendMessage(GetDlgItem(hwndDlg,IDC_STEP2), BUTTONSETASFLATBTN, TRUE, 0); SendMessage(GetDlgItem(hwndDlg,IDC_STEP3), BUTTONSETASFLATBTN, TRUE, 0); SendMessage(GetDlgItem(hwndDlg,IDC_STEP4), BUTTONSETASFLATBTN, TRUE, 0); // set icons SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadIconEx("main", TRUE)); SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIconEx("main", FALSE)); WindowList_Add(hWindowList, hwndDlg, NULL); ShowWindow(hwndDlg, SW_SHOW); break; case WM_COMMAND: switch(LOWORD(wParam)) { case IDC_STEP1: // update current data CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, (LPARAM)_T("http://miranda-ng.org/")); break; case IDC_STEP2: { TCHAR szPath[1024]; GetModuleFileName(GetModuleHandle(NULL), szPath, SIZEOF(szPath)); TCHAR *chop = _tcsrchr(szPath, '\\'); *chop = '\0'; _tcsncat(szPath, _T("\\Plugins\\weather\\"),SIZEOF(szPath)); _tmkdir(szPath); ShellExecute((HWND)lParam, _T("open"), szPath, _T(""), _T(""), SW_SHOW); break; } case IDC_STEP3: if (LoadWIData(false)) MessageBox(NULL, TranslateT("All update data has been reloaded."), TranslateT("Weather Protocol"), MB_OK|MB_ICONINFORMATION); break; case IDC_STEP4: WeatherAdd(0, 0); case IDCANCEL: // close the info window DestroyWindow(hwndDlg); break; } break; case WM_CLOSE: DestroyWindow(hwndDlg); break; case WM_DESTROY: ReleaseIconEx((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, 0)); ReleaseIconEx((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, 0)); break; } return FALSE; }
INT_PTR NewsAggrLoadIcon(WPARAM wParam, LPARAM) { return (LOWORD(wParam) == PLI_PROTOCOL) ? (INT_PTR)CopyIcon(LoadIconEx("main", FALSE)) : 0; }
void Chat_ModulesLoaded() { g_Settings.hIconOverlay = LoadIconEx(IDI_OVERLAY, "overlay", 16, 16); }
INT_PTR CALLBACK DlgProcContactOpts(HWND hwnd, UINT msg, WPARAM, LPARAM lParam) { switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwnd); SendDlgItemMessage(hwnd, IDC_ICO_AUTO, STM_SETICON, (WPARAM)LoadIconEx(IDI_ACT_OK), 0); SendDlgItemMessage(hwnd, IDC_ICO_FAVORITE, STM_SETICON, (WPARAM)LoadIconEx(IDI_OPT_FAVORITE), 0); SendDlgItemMessage(hwnd, IDC_ICO_FULLSCREEN, STM_SETICON, (WPARAM)LoadIconEx(IDI_OPT_FULLSCREEN), 0); SendDlgItemMessage(hwnd, IDC_ICO_BLOCK, STM_SETICON, (WPARAM)LoadIconEx(IDI_OPT_BLOCK), 0); { HIMAGELIST hIml = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 5, 5); ImageList_AddIcon(hIml, Skin_LoadIcon(SKINICON_OTHER_SMALLDOT)); ImageList_AddIcon(hIml, LoadIconEx(IDI_ACT_OK)); ImageList_AddIcon(hIml, LoadIconEx(IDI_OPT_FAVORITE)); ImageList_AddIcon(hIml, LoadIconEx(IDI_OPT_FULLSCREEN)); ImageList_AddIcon(hIml, LoadIconEx(IDI_OPT_BLOCK)); SendDlgItemMessage(hwnd, IDC_LIST, CLM_SETEXTRAIMAGELIST, 0, (LPARAM)hIml); SendDlgItemMessage(hwnd, IDC_LIST, CLM_SETEXTRACOLUMNS, 4 /*_countof(sttIcons)*/, 0); sttResetListOptions(GetDlgItem(hwnd, IDC_LIST)); sttSetAllContactIcons(GetDlgItem(hwnd, IDC_LIST)); } break; case WM_NOTIFY: switch (((LPNMHDR)lParam)->idFrom) { case IDC_LIST: switch (((LPNMHDR)lParam)->code) { case CLN_NEWCONTACT: case CLN_LISTREBUILT: sttSetAllContactIcons(GetDlgItem(hwnd, IDC_LIST)); break; case CLN_OPTIONSCHANGED: sttResetListOptions(GetDlgItem(hwnd, IDC_LIST)); break; case NM_CLICK: NMCLISTCONTROL *nm = (NMCLISTCONTROL*)lParam; if (nm->iColumn == -1) break; DWORD hitFlags; HANDLE hItem = (HANDLE)SendDlgItemMessage(hwnd, IDC_LIST, CLM_HITTEST, (WPARAM)&hitFlags, MAKELPARAM(nm->pt.x, nm->pt.y)); if (hItem == NULL) break; if (!(hitFlags&CLCHT_ONITEMEXTRA)) break; int iImage = SendDlgItemMessage(hwnd, IDC_LIST, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(nm->iColumn, 0)); if (iImage != EMPTY_EXTRA_ICON) { for (int i = 0; i < 4 /*_countof(sttIcons)*/; ++i) // hIml element [0] = SKINICON_OTHER_SMALLDOT // hIml element [1..5] = IcoLib_GetIcon(....) ~ old sttIcons SendDlgItemMessage(hwnd, IDC_LIST, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(i, (i == nm->iColumn) ? i + 1 : 0)); } SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); } break; case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: HWND hwndList = GetDlgItem(hwnd, IDC_LIST); for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, hContact, 0); for (int i = 0; i < 4 /*_countof(sttIcons)*/; ++i) { if (SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(i, 0))) { db_set_b(hContact, MODULNAME, "ShowMode", i); break; } } } return TRUE; } } break; } return FALSE; }
void RichHtmlExport::WriteHeader(const std::wstring &fileName, const std::wstring &filterName, const std::wstring &myName, const std::wstring &myId, const std::wstring &name1, const std::wstring &proto1, const std::wstring &id1, const std::string& baseProto1, const std::wstring& encoding) { baseProto = baseProto1; folder = RemoveExt(fileName) + L"_files"; folderName = GetName(folder); DeleteDirectory(folder.c_str()); CreateDirectory(folder.c_str(), nullptr); std::wstring css = folder + L"\\history.css"; BOOL cssCopied = FALSE; if (!Options::instance->extCssHtml2.empty()) cssCopied = CopyFile(Options::instance->extCssHtml2.c_str(), css.c_str(), FALSE); if (!cssCopied) ExtractFile(IDR_CSS, css); ExtractFile(IDR_JS, folder + L"\\history.js"); HICON ico = LoadIconEx(IDI_PLUSEX); IcoSave(folder + L"\\pnode.ico", ico); IcoLib_ReleaseIcon(ico); ico = LoadIconEx(IDI_MINUSEX); IcoSave(folder + L"\\mnode.ico", ico); IcoLib_ReleaseIcon(ico); ico = LoadIconEx(IDI_INM); IcoSave(folder + L"\\event0.ico", ico); IcoLib_ReleaseIcon(ico); ico = LoadIconEx(IDI_OUTM); IcoSave(folder + L"\\event1.ico", ico); IcoLib_ReleaseIcon(ico); EXP_FILE << L"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n"; EXP_FILE << L"<html><head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=" << encoding << L"\">\n"; EXP_FILE << L"<title>" << TranslateT("History log") << L" [" << MakeTextHtmled(myName) << L"] - [" << MakeTextHtmled(name1) << L"]</title>\n"; EXP_FILE << L"<link rel=\"Stylesheet\" href=\"" << folderName << L"\\history.css\" type=\"text/css\">\n"; EXP_FILE << L"<script type=\"text/javascript\" src=\"" << folderName << L"\\history.js\"></script>\n"; EXP_FILE << L"</head><body>\n"; EXP_FILE << L"<span id=\"menubar\">\n"; EXP_FILE << L"<a class=mainmenu onmouseover='this.className=\"mainmenusel\";' href=\"javascript:void(0)\" onClick=\"ShowMenu(1)\" onMouseOut='HideMenu();this.className=\"mainmenu\";'>" << TranslateT("Menu") << L"</a></span>\n"; EXP_FILE << L"<span class=floatmenu id=L1 onmouseover=clearTimeout(timer) onmouseout=HideMenu()>\n"; EXP_FILE << L"<table><tr>\n"; EXP_FILE << L"<td class=menuitemunsel onmouseover='this.className=\"menuitemsel\"' onmouseout='this.className=\"menuitemunsel\"'>\n"; EXP_FILE << L"<a class=menuitem onmouseover=ShowMenu(1) href=\"javascript:void(0)\" onclick=OpenAll(1)>" << TranslateT("Open all") << L"</a>\n"; EXP_FILE << L"</td></tr><tr>\n"; EXP_FILE << L"<td class=menuitemunsel onmouseover='this.className=\"menuitemsel\"' onmouseout='this.className=\"menuitemunsel\"'>\n"; EXP_FILE << L"<a class=menuitem onmouseover=ShowMenu(1) href=\"javascript:void(0)\" onclick=OpenAll(0)>" << TranslateT("Close all") << L"</a>\n"; EXP_FILE << L"</td></tr></table></span>\n"; EXP_FILE << L"<script language=\"JavaScript\">\n"; EXP_FILE << L"<!--\n"; EXP_FILE << L"var menu = document.getElementById(\"menubar\");\n"; EXP_FILE << L"if (menu != null)\n"; EXP_FILE << L" menu.style.visibility = \"visible\";\n"; EXP_FILE << L"// -->\n"; EXP_FILE << L"</script>\n"; EXP_FILE << L"<h4>" << TranslateT("History log") << L"</h4>\n<h3>"; EXP_FILE << MakeTextHtmled(myName); if (proto1.length() || myId.length()) EXP_FILE << L" (" << MakeTextHtmled(proto1) << L": " << MakeTextHtmled(myId) << L") - "; else EXP_FILE << L" - "; EXP_FILE << MakeTextHtmled(name1); if (proto1.length() || id1.length()) EXP_FILE << L" (" << MakeTextHtmled(proto1) << L": " << MakeTextHtmled(id1) << L")</h3>\n"; else EXP_FILE << L"</h3>\n"; EXP_FILE << L"<h6>" << TranslateT("Filter:") << L" " << MakeTextHtmled(filterName) << L"</h6>\n"; groupId = 0; }
static void BoxPreview_OnPaint(HWND hwnd, HDC mydc, int mode) { RECT rc; switch (mode) { case 0: { // Avatar HDC hdcAvatar = CreateCompatibleDC(mydc); HBITMAP hbmSave = (HBITMAP)SelectObject(hdcAvatar, hbmNoAvatar); GetClientRect(hwnd, &rc); BITMAP bmp; GetObject(hbmNoAvatar, sizeof(bmp), &bmp); StretchBlt(mydc, 0, 0, rc.right, rc.bottom, hdcAvatar, 0, 0, abs(bmp.bmWidth), abs(bmp.bmHeight), SRCCOPY); SelectObject(hdcAvatar, hbmSave); DeleteDC(hdcAvatar); HRGN rgn = CreateRoundRectRgn(0, 0, rc.right, rc.bottom, 2 * PopupOptions.avatarRadius, 2 * PopupOptions.avatarRadius); FrameRgn(mydc, rgn, (HBRUSH)GetStockObject(BLACK_BRUSH), 1, 1); DeleteObject(rgn); } break; case 1: { // Opacity HBRUSH hbr = CreateSolidBrush(fonts.clBack); HFONT hfnt = (HFONT)SelectObject(mydc, fonts.title); GetClientRect(hwnd, &rc); FillRect(mydc, &rc, hbr); DrawIconEx(mydc, 10, (rc.bottom - rc.top - 16) / 2, LoadIconEx(IDI_POPUP), 16, 16, 0, hbr, DI_NORMAL); SetBkMode(mydc, TRANSPARENT); GetClientRect(hwnd, &rc); rc.left += 30; // 10+16+4 -- icon rc.right -= (rc.right - rc.left) / 3; rc.bottom -= (rc.bottom - rc.top) / 3; DrawText(mydc, _T(MODULNAME_LONG), -1, &rc, DT_CENTER | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER); GetClientRect(hwnd, &rc); rc.left += 30; // 10+16+4 -- icon rc.left += (rc.right - rc.left) / 3; rc.top += (rc.bottom - rc.top) / 3; DrawText(mydc, _T(MODULNAME_LONG), -1, &rc, DT_CENTER | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER); GetClientRect(hwnd, &rc); FrameRect(mydc, &rc, (HBRUSH)GetStockObject(BLACK_BRUSH)); SelectObject(mydc, hfnt); DeleteObject(hbr); } break; case 2: { // Position HBRUSH hbr = CreateSolidBrush(GetSysColor(COLOR_WINDOW)); GetClientRect(hwnd, &rc); FillRect(mydc, &rc, hbr); DeleteObject(hbr); hbr = CreateSolidBrush(GetSysColor(COLOR_HIGHLIGHT)); GetClientRect(hwnd, &rc); rc.right -= 100; rc.top += 100; FillRect(mydc, &rc, hbr); DeleteObject(hbr); HPEN hpen = (HPEN)SelectObject(mydc, CreatePen(PS_DOT, 1, RGB(0, 0, 0))); MoveToEx(mydc, 0, 100, NULL); LineTo(mydc, 201, 100); MoveToEx(mydc, 100, 0, NULL); LineTo(mydc, 100, 201); DeleteObject(SelectObject(mydc, hpen)); HRGN hrgn = CreateRectRgn(0, 0, 0, 0); GetWindowRgn(hwnd, hrgn); FrameRgn(mydc, hrgn, (HBRUSH)GetStockObject(BLACK_BRUSH), 1, 1); DeleteObject(hrgn); } break; } }
INT_PTR CDropbox::ProtoLoadIcon(WPARAM wParam, LPARAM) { return (LOWORD(wParam) == PLI_PROTOCOL) ? (INT_PTR)CopyIcon(LoadIconEx(IDI_DROPBOX)) : 0; }
/* API: Create and set up the Status Bar window. */ void StatusBarCreate(HWND hwndParent, uintptr_t idStatus, HINSTANCE hInst) { RECT rectDialog; int dw, dh; uint8_t i; /* Load our icons into the cache for faster access. */ for (i = 16; i < 18; i++) hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i); for (i = 24; i < 26; i++) hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i); for (i = 32; i < 34; i++) hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i); for (i = 48; i < 50; i++) hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i); for (i = 64; i < 66; i++) hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i); for (i = 80; i < 82; i++) hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i); for (i = 144; i < 146; i++) hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i); for (i = 152; i < 154; i++) hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i); for (i = 160; i < 162; i++) hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i); for (i = 176; i < 178; i++) hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i); for (i = 243; i < 244; i++) hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i); GetWindowRect(hwndParent, &rectDialog); dw = rectDialog.right - rectDialog.left; dh = rectDialog.bottom - rectDialog.top; /* Load the Common Controls DLL if needed. */ InitCommonControls(); /* Create the window, and make sure it's using the STATUS class. */ hwndSBAR = CreateWindowEx(0, STATUSCLASSNAME, (LPCTSTR)NULL, SBARS_SIZEGRIP|WS_CHILD|WS_VISIBLE|SBT_TOOLTIPS, 0, dh-17, dw, 17, hwndParent, (HMENU)idStatus, hInst, NULL); /* Replace the original procedure with ours. */ OriginalProcedure = GetWindowLongPtr(hwndSBAR, GWLP_WNDPROC); SetWindowLongPtr(hwndSBAR, GWL_WNDPROC, (LONG_PTR)&StatusBarProcedure); SendMessage(hwndSBAR, SB_SETMINHEIGHT, (WPARAM)17, (LPARAM)0); /* Align the window with the parent (main) window. */ GetWindowRect(hwndSBAR, &rectDialog); SetWindowPos(hwndSBAR, HWND_TOPMOST, rectDialog.left, rectDialog.top, rectDialog.right-rectDialog.left, rectDialog.bottom-rectDialog.top, SWP_SHOWWINDOW); /* Load the dummu menu for this window. */ menuSBAR = LoadMenu(hInst, SB_MENU_NAME); /* Initialize the status bar. This is clumsy. */ sb_parts = 1; iStatusWidths = (int *)malloc(sb_parts * sizeof(int)); memset(iStatusWidths, 0, sb_parts * sizeof(int)); sb_part_meanings = (int *)malloc(sb_parts * sizeof(int)); memset(sb_part_meanings, 0, sb_parts * sizeof(int)); sb_part_icons = (uint8_t *)malloc(sb_parts * sizeof(uint8_t)); memset(sb_part_icons, 0, sb_parts * sizeof(uint8_t)); sb_menu_handles = (HMENU *)malloc(sb_parts * sizeof(HMENU)); memset(sb_menu_handles, 0, sb_parts * sizeof(HMENU)); sbTips = (WCHAR **)malloc(sb_parts * sizeof(WCHAR *)); memset(sbTips, 0, sb_parts * sizeof(WCHAR *)); sb_parts = 0; iStatusWidths[sb_parts] = -1; sb_part_meanings[sb_parts] = SB_TEXT; sb_part_icons[sb_parts] = 255; sb_parts++; SendMessage(hwndSBAR, SB_SETPARTS, (WPARAM)sb_parts, (LPARAM)iStatusWidths); SendMessage(hwndSBAR, SB_SETTEXT, 0 | SBT_NOBORDERS, (LPARAM)L"Welcome to 86Box !"); sb_ready = 1; }
BOOL CIrcProto::CList_AddDCCChat(const CMString& name, const CMString& hostmask, unsigned long adr, int port) { HANDLE hContact; HANDLE hc; TCHAR szNick[256]; char szService[256]; bool bFlag = false; CONTACT usertemp = { (TCHAR*)name.c_str(), NULL, NULL, false, false, true}; hc = CList_FindContact( &usertemp ); if ( hc && db_get_b( hc, "CList", "NotOnList", 0) == 0 && db_get_b(hc,"CList", "Hidden", 0) == 0) { bFlag = true; } CMString contactname = name; contactname += _T(DCCSTRING); CONTACT user = { (TCHAR*)contactname.c_str(), NULL, NULL, false, false, true}; hContact = CList_AddContact(&user, false, false); setByte(hContact, "DCC", 1); DCCINFO* pdci = new DCCINFO; pdci->sHostmask = hostmask; pdci->hContact = hContact; pdci->dwAdr = (DWORD) adr; pdci->iPort = port; pdci->iType = DCC_CHAT; pdci->bSender = false; pdci->sContactName = name; if ( m_DCCChatAccept == 3 || m_DCCChatAccept == 2 && bFlag ) { CDccSession* dcc = new CDccSession( this, pdci ); CDccSession* olddcc = FindDCCSession(hContact); if ( olddcc ) olddcc->Disconnect(); AddDCCSession(hContact, dcc); dcc->Connect(); if (getByte( "MirVerAutoRequest", 1)) PostIrcMessage( _T("/PRIVMSG %s \001VERSION\001"), name.c_str()); } else { CLISTEVENT cle = {0}; cle.cbSize = sizeof(cle); cle.hContact = (HANDLE)hContact; cle.hDbEvent = (HANDLE)"dccchat"; cle.flags = CLEF_TCHAR; cle.hIcon = LoadIconEx(IDI_DCC); mir_snprintf(szService, sizeof(szService),"%s/DblClickEvent", m_szModuleName); cle.pszService = szService; mir_sntprintf(szNick, SIZEOF(szNick), TranslateT("CTCP chat request from %s"), name.c_str()); cle.ptszTooltip = szNick; cle.lParam = (LPARAM)pdci; if ( CallService(MS_CLIST_GETEVENT, (WPARAM)hContact, 0)) CallService(MS_CLIST_REMOVEEVENT, (WPARAM)hContact, (LPARAM)"dccchat"); CallService(MS_CLIST_ADDEVENT,(WPARAM) hContact,(LPARAM) &cle); } return TRUE; }