本文整理汇总了C++中TranslateDialogDefault函数的典型用法代码示例。如果您正苦于以下问题:C++ TranslateDialogDefault函数的具体用法?C++ TranslateDialogDefault怎么用?C++ TranslateDialogDefault使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TranslateDialogDefault函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SettingsDlgProc
static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam)
{
switch(msg) {
case WM_INITDIALOG:
{
LCID locale;
hwndSettingsDlg=hwndDlg;
TranslateDialogDefault(hwndDlg);
locale=CallService(MS_LANGPACK_GETLOCALE,0,0);
SendDlgItemMessage(hwndDlg,IDC_ICON_HEADER,STM_SETIMAGE,IMAGE_ICON,(LPARAM)Skin_GetIcon("AutoShutdown_Header"));
{
HFONT hBoldFont;
LOGFONT lf;
if (GetObject((HFONT)SendDlgItemMessage(hwndDlg,IDC_TEXT_HEADER,WM_GETFONT,0,0),sizeof(lf),&lf)) {
lf.lfWeight=FW_BOLD;
hBoldFont=CreateFontIndirect(&lf);
} else hBoldFont=NULL;
SendDlgItemMessage(hwndDlg,IDC_TEXT_HEADER,WM_SETFONT,(WPARAM)hBoldFont,FALSE);
}
/* read-in watcher flags */
{
WORD watcherType=db_get_w(NULL,"AutoShutdown","WatcherFlags",SETTING_WATCHERFLAGS_DEFAULT);
CheckRadioButton(hwndDlg,IDC_RADIO_STTIME,IDC_RADIO_STCOUNTDOWN,(watcherType&SDWTF_ST_TIME)?IDC_RADIO_STTIME:IDC_RADIO_STCOUNTDOWN);
CheckDlgButton(hwndDlg,IDC_CHECK_SPECIFICTIME,(watcherType&SDWTF_SPECIFICTIME) != 0 ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg,IDC_CHECK_MESSAGE,(watcherType&SDWTF_MESSAGE) != 0 ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg,IDC_CHECK_FILETRANSFER,(watcherType&SDWTF_FILETRANSFER) != 0 ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg,IDC_CHECK_IDLE,(watcherType&SDWTF_IDLE) != 0 ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg,IDC_CHECK_STATUS,(watcherType&SDWTF_STATUS) != 0 ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg,IDC_CHECK_CPUUSAGE,(watcherType&SDWTF_CPUUSAGE) != 0 ? BST_CHECKED : BST_UNCHECKED);
}
/* read-in countdown val */
{
SYSTEMTIME st;
if (!TimeStampToSystemTime((time_t)db_get_dw(NULL,"AutoShutdown","TimeStamp",SETTING_TIMESTAMP_DEFAULT),&st))
GetLocalTime(&st);
DateTime_SetSystemtime(GetDlgItem(hwndDlg,IDC_TIME_TIMESTAMP),GDT_VALID,&st);
DateTime_SetSystemtime(GetDlgItem(hwndDlg,IDC_DATE_TIMESTAMP),GDT_VALID,&st);
SendMessage(hwndDlg,M_CHECK_DATETIME,0,0);
}
{
DWORD setting=db_get_dw(NULL,"AutoShutdown","Countdown",SETTING_COUNTDOWN_DEFAULT);
if (setting<1) setting=SETTING_COUNTDOWN_DEFAULT;
SendDlgItemMessage(hwndDlg,IDC_SPIN_COUNTDOWN,UDM_SETRANGE,0,MAKELPARAM(UD_MAXVAL,1));
SendDlgItemMessage(hwndDlg,IDC_EDIT_COUNTDOWN,EM_SETLIMITTEXT,(WPARAM)10,0);
SendDlgItemMessage(hwndDlg,IDC_SPIN_COUNTDOWN,UDM_SETPOS,0,MAKELPARAM(setting,0));
SetDlgItemInt(hwndDlg,IDC_EDIT_COUNTDOWN,setting,FALSE);
}
{
HWND hwndCombo=GetDlgItem(hwndDlg,IDC_COMBO_COUNTDOWNUNIT);
DWORD lastUnit=db_get_dw(NULL,"AutoShutdown","CountdownUnit",SETTING_COUNTDOWNUNIT_DEFAULT);
SendMessage(hwndCombo,CB_SETLOCALE,(WPARAM)locale,0); /* sort order */
SendMessage(hwndCombo,CB_INITSTORAGE,SIZEOF(unitNames),SIZEOF(unitNames)*16); /* approx. */
for(int i=0;i<SIZEOF(unitNames);++i) {
int index=SendMessage(hwndCombo,CB_ADDSTRING,0,(LPARAM)TranslateTS(unitNames[i]));
if (index != LB_ERR) {
SendMessage(hwndCombo,CB_SETITEMDATA,index,(LPARAM)unitValues[i]);
if (i==0 || unitValues[i]==lastUnit) SendMessage(hwndCombo,CB_SETCURSEL,index,0);
}
}
}
{
DBVARIANT dbv;
if (!db_get_ts(NULL,"AutoShutdown","Message",&dbv)) {
SetDlgItemText(hwndDlg,IDC_EDIT_MESSAGE,dbv.ptszVal);
mir_free(dbv.ptszVal);
}
}
/* cpuusage threshold */
{
BYTE setting=DBGetContactSettingRangedByte(NULL,"AutoShutdown","CpuUsageThreshold",SETTING_CPUUSAGETHRESHOLD_DEFAULT,1,100);
SendDlgItemMessage(hwndDlg,IDC_SPIN_CPUUSAGE,UDM_SETRANGE,0,MAKELPARAM(100,1));
SendDlgItemMessage(hwndDlg,IDC_EDIT_CPUUSAGE,EM_SETLIMITTEXT,(WPARAM)3,0);
SendDlgItemMessage(hwndDlg,IDC_SPIN_CPUUSAGE,UDM_SETPOS,0,MAKELPARAM(setting,0));
SetDlgItemInt(hwndDlg,IDC_EDIT_CPUUSAGE,setting,FALSE);
}
/* shutdown types */
{
HWND hwndCombo=GetDlgItem(hwndDlg,IDC_COMBO_SHUTDOWNTYPE);
BYTE lastShutdownType=db_get_b(NULL,"AutoShutdown","ShutdownType",SETTING_SHUTDOWNTYPE_DEFAULT);
SendMessage(hwndCombo,CB_SETLOCALE,(WPARAM)locale,0); /* sort order */
SendMessage(hwndCombo,CB_SETEXTENDEDUI,TRUE,0);
SendMessage(hwndCombo,CB_INITSTORAGE,SDSDT_MAX,SDSDT_MAX*32);
for(BYTE shutdownType=1;shutdownType<=SDSDT_MAX;++shutdownType)
if (ServiceIsTypeEnabled(shutdownType,0)) {
TCHAR *pszText=(TCHAR*)ServiceGetTypeDescription(shutdownType,GSTDF_TCHAR); /* never fails */
int index=SendMessage(hwndCombo,CB_ADDSTRING,0,(LPARAM)pszText);
if (index != LB_ERR) {
SendMessage(hwndCombo,CB_SETITEMDATA,index,(LPARAM)shutdownType);
if (shutdownType==1 || shutdownType==lastShutdownType) SendMessage(hwndCombo,CB_SETCURSEL,(WPARAM)index,0);
}
}
SendMessage(hwndDlg,M_UPDATE_SHUTDOWNDESC,0,(LPARAM)hwndCombo);
}
/* check if proto is installed that supports instant messages and check if a message dialog plugin is installed */
if (!AnyProtoHasCaps(PF1_IMRECV) || !ServiceExists(MS_MSG_SENDMESSAGE)) { /* no srmessage present? */
CheckDlgButton(hwndDlg, IDC_CHECK_MESSAGE, BST_UNCHECKED);
EnableWindow(GetDlgItem(hwndDlg,IDC_CHECK_MESSAGE),FALSE);
EnableWindow(GetDlgItem(hwndDlg,IDC_EDIT_MESSAGE),FALSE);
}
/* check if proto is installed that supports file transfers and check if a file transfer dialog is available */
//.........这里部分代码省略.........
示例2: DlgProcSetup
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;
}
示例3: switch
INT_PTR CALLBACK CVkProto::OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
CVkProto *ppro = (CVkProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (uMsg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
ppro = (CVkProto*)lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_GetIconByHandle(ppro->m_hProtoIcon, true));
SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)Skin_GetIconByHandle(ppro->m_hProtoIcon));
{
ptrT tszLogin(ppro->getTStringA("Login"));
if (tszLogin != NULL)
SetDlgItemText(hwndDlg, IDC_LOGIN, tszLogin);
ptrT tszPassw(ppro->GetUserStoredPassword());
if (tszPassw != NULL)
SetDlgItemText(hwndDlg, IDC_PASSWORD, tszPassw);
SetDlgItemText(hwndDlg, IDC_GROUPNAME, ppro->getGroup());
}
CheckDlgButton(hwndDlg, IDC_DELIVERY, ppro->m_bServerDelivery);
CheckDlgButton(hwndDlg, IDC_HIDECHATS, ppro->m_bHideChats);
CheckDlgButton(hwndDlg, IDC_AUTOCLEAN, ppro->getByte("AutoClean", 0));
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_URL:
CallService(MS_UTILS_OPENURL, 1, (LPARAM)"http://www.vk.com");
break;
case IDC_LOGIN:
case IDC_PASSWORD:
case IDC_GROUPNAME:
if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus())
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case IDC_DELIVERY:
case IDC_HIDECHATS:
case IDC_AUTOCLEAN:
if (HIWORD(wParam) == BN_CLICKED && (HWND)lParam == GetFocus())
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
}
break;
case WM_NOTIFY:
if (((LPNMHDR)lParam)->code == PSN_APPLY) {
TCHAR str[128];
GetDlgItemText(hwndDlg, IDC_LOGIN, str, SIZEOF(str));
ppro->setTString("Login", str);
GetDlgItemText(hwndDlg, IDC_GROUPNAME, str, SIZEOF(str));
if (_tcscmp(ppro->getGroup(), str)) {
ppro->setGroup(str);
ppro->setTString("ProtoGroup", str);
}
GetDlgItemText(hwndDlg, IDC_PASSWORD, str, SIZEOF(str));
ptrA szRawPasswd(mir_utf8encodeT(str));
if (szRawPasswd != NULL)
ppro->setString("Password", szRawPasswd);
ppro->m_bServerDelivery = IsDlgButtonChecked(hwndDlg, IDC_DELIVERY) == BST_CHECKED;
ppro->setByte("ServerDelivery", ppro->m_bServerDelivery);
ppro->m_bHideChats = IsDlgButtonChecked(hwndDlg, IDC_HIDECHATS) == BST_CHECKED;
ppro->setByte("HideChats", ppro->m_bHideChats);
ppro->setByte("AutoClean", IsDlgButtonChecked(hwndDlg, IDC_AUTOCLEAN) == BST_CHECKED);
}
break;
case WM_CLOSE:
EndDialog(hwndDlg, 0);
break;
case WM_DESTROY:
Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_BIG, 0));
Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_SMALL, 0));
break;
}
return FALSE;
}
示例4: ReadAwayMsgDlgProc
static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
{
HICON hTitleIcon = Skin_LoadIcon(SKINICON_OTHER_MIRANDA);
SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hTitleIcon);
SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)hTitleIcon);
Utils_RestoreWindowPosition(hwndDlg, NULL, MOD_NAME, RAMDLGSIZESETTING);
READAWAYMSGDATA *awayData = new READAWAYMSGDATA;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)awayData);
awayData->hContact = lParam;
awayData->hAwayMsgEvent = HookEventMessage(ME_PROTO_ACK, hwndDlg, UM_RAM_AWAYMSGACK);
awayData->hSeq = (HANDLE)CallContactService(awayData->hContact, PSS_GETAWAYMSG, 0, 0);
WindowList_Add(g_hReadWndList, hwndDlg, awayData->hContact);
TCHAR str[256], format[128];
TCHAR *contactName = pcli->pfnGetContactDisplayName(awayData->hContact, 0);
char *szProto = GetContactProto(awayData->hContact);
TCHAR *status = pcli->pfnGetStatusModeDescription(db_get_w(awayData->hContact, szProto, "Status", ID_STATUS_OFFLINE), 0);
GetWindowText(hwndDlg, format, _countof(format));
mir_sntprintf(str, _countof(str), format, status, contactName);
SetWindowText(hwndDlg, str);
GetDlgItemText(hwndDlg, IDC_READAWAYMSG_RETRIEVE, format, _countof(format));
mir_sntprintf(str, _countof(str), format, status);
SetDlgItemText(hwndDlg, IDC_READAWAYMSG_RETRIEVE, str);
}
return true;
case UM_RAM_AWAYMSGACK: // got away msg
{
ACKDATA *ack = (ACKDATA*)lParam;
READAWAYMSGDATA *awayData = (READAWAYMSGDATA*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
// make sure everything is ok, and this is our ack
if (ack->hContact != awayData->hContact || ack->type != ACKTYPE_AWAYMSG || ack->hProcess != awayData->hSeq || ack->result != ACKRESULT_SUCCESS)
break;
// done with the event
if (awayData->hAwayMsgEvent) {
UnhookEvent(awayData->hAwayMsgEvent);
awayData->hAwayMsgEvent = NULL;
}
const TCHAR *ptszStatusMsg = (const TCHAR*)ack->lParam;
SetDlgItemText(hwndDlg, IDC_READAWAYMSG_MSG, ptszStatusMsg);
ShowWindow(GetDlgItem(hwndDlg, IDC_READAWAYMSG_RETRIEVE), SW_HIDE);
ShowWindow(GetDlgItem(hwndDlg, IDC_READAWAYMSG_MSG), SW_SHOW);
SetDlgItemText(hwndDlg, IDOK, TranslateT("&Close"));
db_set_ts(awayData->hContact, "CList", "StatusMsg", ptszStatusMsg);
}
break;
case WM_COMMAND:
switch (HIWORD(wParam)) {
case BN_CLICKED:
switch (LOWORD(wParam)) {
case IDCANCEL:
case IDOK:
DestroyWindow(hwndDlg);
break;
}
}
break;
case WM_SIZE:
Utils_ResizeDialog(hwndDlg, g_hInstance, MAKEINTRESOURCEA(IDD_READAWAYMSG), ReadAwayMsgDlgResize);
break;
case WM_CLOSE:
DestroyWindow(hwndDlg);
break;
case WM_DESTROY:
READAWAYMSGDATA *awayData = (READAWAYMSGDATA*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
if (awayData->hAwayMsgEvent) {
UnhookEvent(awayData->hAwayMsgEvent);
awayData->hAwayMsgEvent = NULL;
}
delete awayData;
Utils_SaveWindowPosition(hwndDlg, NULL, MOD_NAME, RAMDLGSIZESETTING);
WindowList_Remove(g_hReadWndList, hwndDlg);
}
return false;
}
示例5: DlgProcUrlSend
INT_PTR CALLBACK DlgProcUrlSend(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
struct UrlSendData* dat = (struct UrlSendData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
Window_SetIcon_IcoLib(hwndDlg, SKINICON_EVENT_URL);
Button_SetIcon_IcoLib(hwndDlg, IDC_ADD, SKINICON_OTHER_ADDCONTACT, LPGEN("Add contact permanently to list"));
Button_SetIcon_IcoLib(hwndDlg, IDC_DETAILS, SKINICON_OTHER_USERDETAILS, LPGEN("View user's details"));
Button_SetIcon_IcoLib(hwndDlg, IDC_HISTORY, SKINICON_OTHER_HISTORY, LPGEN("View user's history"));
Button_SetIcon_IcoLib(hwndDlg, IDC_USERMENU, SKINICON_OTHER_DOWNARROW, LPGEN("User menu"));
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_LIMITTEXT, 450, 0);
dat = (struct UrlSendData*)mir_alloc(sizeof(struct UrlSendData));
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat);
dat->hContact = lParam;
dat->hAckEvent = NULL;
dat->hSendId = NULL;
dat->sendBuffer = NULL;
WindowList_Add(hUrlWindowList, hwndDlg, dat->hContact);
{
TCHAR *str = pcli->pfnGetContactDisplayName(dat->hContact, 0);
SetDlgItemText(hwndDlg, IDC_NAME, str);
}
GetOpenBrowserUrls(hwndDlg, GetDlgItem(hwndDlg, IDC_URLS));
SendDlgItemMessage(hwndDlg, IDC_URLS, CB_SETCURSEL, 0, 0);
if (SendDlgItemMessage(hwndDlg, IDC_URLS, CB_GETCOUNT, 0, 0))SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_URLS, CBN_SELCHANGE), 0);
EnableWindow(GetDlgItem(hwndDlg, IDOK), (SendDlgItemMessage(hwndDlg, IDC_URLS, CB_GETCURSEL, 0, 0) == CB_ERR)?FALSE:TRUE);
Utils_RestoreWindowPositionNoSize(hwndDlg, NULL, "SRUrl", "send");
mir_subclassWindow( GetDlgItem(hwndDlg, IDC_MESSAGE), SendEditSubclassProc);
mir_subclassWindow( GetWindow(GetDlgItem(hwndDlg, IDC_URLS), GW_CHILD), SendEditSubclassProc);
// From message dlg
if ( !db_get_b(dat->hContact, "CList", "NotOnList", 0))
ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), SW_HIDE);
SendMessage(hwndDlg, DM_UPDATETITLE, 0, 0);
// From message dlg end
return TRUE;
case WM_DDE_DATA:
case WM_DDE_ACK:
return DdeMessage(hwndDlg, msg, wParam, lParam);
case WM_TIMER:
if (wParam == 0) {
//ICQ sendurl timed out
KillTimer(hwndDlg, 0);
MessageBox(hwndDlg, TranslateT("Send timed out"), _T(""), MB_OK);
EnableWindow(GetDlgItem(hwndDlg, IDOK), TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_URLS), TRUE);
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETREADONLY, FALSE, 0);
}
break;
case WM_MEASUREITEM:
return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam);
case WM_DRAWITEM:
{
LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam;
if (dis->hwndItem == GetDlgItem(hwndDlg, IDC_PROTOCOL)) {
char *szProto = GetContactProto(dat->hContact);
if (szProto) {
HICON hIcon = (HICON)CallProtoService(szProto, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0);
if (hIcon) {
DrawIconEx(dis->hDC, dis->rcItem.left, dis->rcItem.top, hIcon, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL);
DestroyIcon(hIcon);
} } } }
return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
case DM_UPDATETITLE:
sttUpdateTitle(hwndDlg, dat->hContact);
break;
case WM_COMMAND:
if (CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)dat->hContact))
break;
switch (LOWORD(wParam)) {
case IDOK:
{
char *body, *url;
int bodySize, urlSize;
urlSize = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_URLS))+1;
url = (char*)mir_alloc(urlSize);
GetDlgItemTextA(hwndDlg, IDC_URLS, url, urlSize);
if (url[0] == 0) {
mir_free(url);
break;
}
bodySize = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE))+1;
body = (char*)mir_alloc(bodySize);
GetDlgItemTextA(hwndDlg, IDC_MESSAGE, body, bodySize);
dat->sendBuffer = (char*)mir_realloc(dat->sendBuffer, lstrlenA(url)+lstrlenA(body)+2);
lstrcpyA(dat->sendBuffer, url);
//.........这里部分代码省略.........
示例6: JabberSearchAdvancedDlgProc
static INT_PTR CALLBACK JabberSearchAdvancedDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
JabberSearchData* dat = (JabberSearchData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
{
dat = (JabberSearchData *)mir_calloc(sizeof(JabberSearchData));
dat->ppro = (CJabberProto*)lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat);
/* Server Combo box */
ptrA jud(dat->ppro->getStringA("Jud"));
char *szServerName = (jud == NULL) ? "users.jabber.org": jud;
SetDlgItemTextA(hwndDlg,IDC_SERVER,szServerName);
SendDlgItemMessageA(hwndDlg,IDC_SERVER,CB_ADDSTRING,0,(LPARAM)szServerName);
//TO DO: Add Transports here
int i, transpCount = dat->ppro->m_lstTransports.getCount();
for (i=0; i < transpCount; i++) {
TCHAR *szTransp = dat->ppro->m_lstTransports[i];
if (szTransp)
JabberSearchAddUrlToRecentCombo(hwndDlg, szTransp);
}
for (i=0; i < 10; i++) {
char key[30];
mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", i);
ptrT szValue( dat->ppro->getTStringA(key));
if (szValue != NULL)
JabberSearchAddUrlToRecentCombo(hwndDlg, szValue);
}
//TO DO: Add 4 recently used
dat->lastRequestIq = dat->ppro->SearchRenewFields(hwndDlg,dat);
}
return TRUE;
case WM_COMMAND:
if (LOWORD(wParam) == IDC_SERVER) {
switch (HIWORD(wParam)) {
case CBN_SETFOCUS:
PostMessage(GetParent(hwndDlg),WM_COMMAND, MAKEWPARAM(0,EN_SETFOCUS), (LPARAM)hwndDlg);
return TRUE;
case CBN_EDITCHANGE:
EnableWindow(GetDlgItem(hwndDlg, IDC_GO),TRUE);
return TRUE;
case CBN_EDITUPDATE:
JabberSearchFreeData(hwndDlg, dat);
EnableWindow(GetDlgItem(hwndDlg, IDC_GO),TRUE);
return TRUE;
case CBN_SELENDOK:
EnableWindow(GetDlgItem(hwndDlg, IDC_GO),TRUE);
PostMessage(hwndDlg,WM_COMMAND,MAKEWPARAM(IDC_GO,BN_CLICKED),0);
return TRUE;
}
}
else if (LOWORD(wParam) == IDC_GO && HIWORD(wParam) == BN_CLICKED) {
dat->ppro->SearchRenewFields(hwndDlg, dat);
return TRUE;
}
break;
case WM_SIZE:
{
//Resize IDC_FRAME to take full size
RECT rcForm;
GetWindowRect(hwndDlg, &rcForm);
RECT rcFrame;
GetWindowRect(GetDlgItem(hwndDlg, IDC_FRAME), &rcFrame);
rcFrame.bottom = rcForm.bottom;
SetWindowPos(GetDlgItem(hwndDlg,IDC_FRAME),NULL,0,0,rcFrame.right-rcFrame.left,rcFrame.bottom-rcFrame.top,SWP_NOZORDER|SWP_NOMOVE);
GetWindowRect(GetDlgItem(hwndDlg,IDC_VSCROLL), &rcForm);
SetWindowPos(GetDlgItem(hwndDlg,IDC_VSCROLL),NULL,0,0,rcForm.right-rcForm.left,rcFrame.bottom-rcFrame.top,SWP_NOZORDER|SWP_NOMOVE);
JabberSearchRefreshFrameScroll(hwndDlg, dat);
}
return TRUE;
case WM_USER+11:
{
dat->fSearchRequestIsXForm=TRUE;
dat->xNode = (HXML)wParam;
JabberFormCreateUI(GetDlgItem(hwndDlg, IDC_FRAME), dat->xNode, &dat->CurrentHeight,TRUE);
ShowWindow(GetDlgItem(hwndDlg, IDC_FRAME), SW_SHOW);
dat->nJSInfCount=1;
return TRUE;
}
case WM_USER+10:
{
Data* MyDat = (Data*)lParam;
if (MyDat) {
dat->fSearchRequestIsXForm = (BOOL)wParam;
dat->CurrentHeight = JabberSearchAddField(hwndDlg,MyDat);
mir_free(MyDat->Label);
mir_free(MyDat->Var);
mir_free(MyDat->defValue);
free(MyDat);
}
//.........这里部分代码省略.........
示例7: DlgProfileManager
static INT_PTR CALLBACK DlgProfileManager(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
struct DetailsData* dat = ( struct DetailsData* )GetWindowLongPtr( hwndDlg, GWLP_USERDATA );
switch (msg) {
case WM_INITDIALOG:
{
struct DlgProfData * prof = (struct DlgProfData *)lParam;
PROPSHEETHEADER *psh = prof->psh;
TranslateDialogDefault(hwndDlg);
SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadImage(hMirandaInst, MAKEINTRESOURCE(IDI_USERDETAILS),IMAGE_ICON,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0));
SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadImage(hMirandaInst, MAKEINTRESOURCE(IDI_USERDETAILS),IMAGE_ICON,GetSystemMetrics(SM_CXICON),GetSystemMetrics(SM_CYICON),0));
dat = (struct DetailsData*)mir_alloc(sizeof(struct DetailsData));
dat->prof = prof;
prof->hwndOK = GetDlgItem( hwndDlg, IDOK );
EnableWindow( prof->hwndOK, FALSE );
SetWindowLongPtr( hwndDlg, GWLP_USERDATA, (LONG_PTR)dat );
{
TCHAR buf[512];
mir_sntprintf(buf, SIZEOF(buf), _T("%s: %s\n%s"), TranslateT("Miranda Profiles from"), prof->pd->szProfileDir,
TranslateT("Select or create your Miranda IM user profile"));
SetDlgItemText(hwndDlg, IDC_NAME, buf);
}
{ OPTIONSDIALOGPAGE *odp;
int i;
TCITEM tci;
dat->currentPage = 0;
dat->pageCount = psh->nPages;
dat->opd = ( struct DetailsPageData* )mir_calloc( sizeof( struct DetailsPageData )*dat->pageCount );
odp = ( OPTIONSDIALOGPAGE* )psh->ppsp;
tci.mask = TCIF_TEXT;
for( i=0; i < dat->pageCount; i++ ) {
dat->opd[i].pTemplate = (DLGTEMPLATE *)LockResource(LoadResource(odp[i].hInstance,FindResourceA(odp[i].hInstance,odp[i].pszTemplate,MAKEINTRESOURCEA(5))));
dat->opd[i].dlgProc = odp[i].pfnDlgProc;
dat->opd[i].hInst = odp[i].hInstance;
dat->opd[i].hwnd = NULL;
dat->opd[i].changed = 0;
tci.pszText = ( TCHAR* )odp[i].ptszTitle;
if (dat->prof->pd->noProfiles || shouldAutoCreate(dat->prof->pd->szProfile))
dat->currentPage = 1;
TabCtrl_InsertItem( GetDlgItem(hwndDlg,IDC_TABS), i, &tci );
} }
GetWindowRect(GetDlgItem(hwndDlg,IDC_TABS),&dat->rcDisplay);
TabCtrl_AdjustRect(GetDlgItem(hwndDlg,IDC_TABS),FALSE,&dat->rcDisplay);
{
POINT pt = {0,0};
ClientToScreen( hwndDlg, &pt );
OffsetRect( &dat->rcDisplay, -pt.x, -pt.y );
}
TabCtrl_SetCurSel( GetDlgItem( hwndDlg, IDC_TABS ), dat->currentPage );
dat->opd[dat->currentPage].hwnd = CreateDialogIndirectParam(dat->opd[dat->currentPage].hInst,dat->opd[dat->currentPage].pTemplate,hwndDlg,dat->opd[dat->currentPage].dlgProc,(LPARAM)dat->prof);
ThemeDialogBackground( dat->opd[dat->currentPage].hwnd );
SetWindowPos( dat->opd[dat->currentPage].hwnd, HWND_TOP, dat->rcDisplay.left, dat->rcDisplay.top, 0, 0, SWP_NOSIZE );
{ PSHNOTIFY pshn;
pshn.hdr.code = PSN_INFOCHANGED;
pshn.hdr.hwndFrom = dat->opd[dat->currentPage].hwnd;
pshn.hdr.idFrom = 0;
pshn.lParam = ( LPARAM )0;
SendMessage( dat->opd[dat->currentPage].hwnd, WM_NOTIFY, 0, ( LPARAM )&pshn );
}
// service mode combobox
{
char **list = GetSeviceModePluginsList();
if ( !list ) {
ShowWindow( GetDlgItem(hwndDlg, IDC_SM_LABEL ), FALSE );
ShowWindow( GetDlgItem(hwndDlg, IDC_SM_COMBO ), FALSE );
} else {
int i = 0;
LRESULT index;
HWND hwndCombo = GetDlgItem(hwndDlg, IDC_SM_COMBO );
index = SendMessage( hwndCombo, CB_ADDSTRING, 0, (LPARAM)_T("") );
SendMessage( hwndCombo, CB_SETITEMDATA, index, (LPARAM)-1 );
SendMessage( hwndCombo, CB_SETCURSEL, 0, 0);
while ( list[i] ) {
TCHAR *str = LangPackPcharToTchar( list[i] );
index = SendMessage( hwndCombo, CB_ADDSTRING, 0, (LPARAM)str );
mir_free(str);
SendMessage( hwndCombo, CB_SETITEMDATA, index, (LPARAM)i );
i++;
}
mir_free(list);
}
}
ShowWindow( dat->opd[dat->currentPage].hwnd, SW_SHOW );
return TRUE;
}
case WM_CTLCOLORSTATIC:
switch ( GetDlgCtrlID(( HWND )lParam )) {
case IDC_WHITERECT:
SetBkColor(( HDC )wParam, GetSysColor( COLOR_WINDOW ));
return ( INT_PTR )GetSysColorBrush( COLOR_WINDOW );
}
break;
//.........这里部分代码省略.........
示例8: TlenUserInfoDlgProc
static BOOL CALLBACK TlenUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
case WM_INITDIALOG:
// lParam is hContact
TranslateDialogDefault(hwndDlg);
SetWindowLong(hwndDlg, GWL_USERDATA, (LONG)(HANDLE) lParam);
InitComboBox(GetDlgItem(hwndDlg, IDC_GENDER), tlenFieldGender);
InitComboBox(GetDlgItem(hwndDlg, IDC_OCCUPATION), tlenFieldOccupation);
InitComboBox(GetDlgItem(hwndDlg, IDC_LOOKFOR), tlenFieldLookfor);
SendMessage(hwndDlg, WM_JABBER_REFRESH, 0, 0);
return TRUE;
case WM_JABBER_REFRESH:
{
DBVARIANT dbv;
HANDLE hContact;
char *jid;
int i;
JABBER_LIST_ITEM *item;
JabberLog("refresh");
SetDlgItemText(hwndDlg, IDC_INFO_JID, "");
SetDlgItemText(hwndDlg, IDC_SUBSCRIPTION, "");
SetFocus(GetDlgItem(hwndDlg, IDC_STATIC));
hContact = (HANDLE) GetWindowLong(hwndDlg, GWL_USERDATA);
if (!DBGetContactSetting(hContact, jabberProtoName, "FirstName", &dbv)) {
SetDlgItemText(hwndDlg, IDC_FIRSTNAME, dbv.pszVal);
DBFreeVariant(&dbv);
} else SetDlgItemText(hwndDlg, IDC_FIRSTNAME, "");
if (!DBGetContactSetting(hContact, jabberProtoName, "LastName", &dbv)) {
SetDlgItemText(hwndDlg, IDC_LASTNAME, dbv.pszVal);
DBFreeVariant(&dbv);
} else SetDlgItemText(hwndDlg, IDC_LASTNAME, "");
if (!DBGetContactSetting(hContact, jabberProtoName, "Nick", &dbv)) {
SetDlgItemText(hwndDlg, IDC_NICKNAME, dbv.pszVal);
DBFreeVariant(&dbv);
} else SetDlgItemText(hwndDlg, IDC_NICKNAME, "");
if (!DBGetContactSetting(hContact, jabberProtoName, "e-mail", &dbv)) {
SetDlgItemText(hwndDlg, IDC_EMAIL, dbv.pszVal);
DBFreeVariant(&dbv);
} else SetDlgItemText(hwndDlg, IDC_EMAIL, "");
if (!DBGetContactSetting(hContact, jabberProtoName, "Age", &dbv)) {
SetDlgItemInt(hwndDlg, IDC_AGE, dbv.wVal, FALSE);
DBFreeVariant(&dbv);
} else SetDlgItemText(hwndDlg, IDC_AGE, "");
if (!DBGetContactSetting(hContact, jabberProtoName, "City", &dbv)) {
SetDlgItemText(hwndDlg, IDC_CITY, dbv.pszVal);
DBFreeVariant(&dbv);
} else SetDlgItemText(hwndDlg, IDC_CITY, "");
if (!DBGetContactSetting(hContact, jabberProtoName, "School", &dbv)) {
SetDlgItemText(hwndDlg, IDC_SCHOOL, dbv.pszVal);
DBFreeVariant(&dbv);
} else SetDlgItemText(hwndDlg, IDC_SCHOOL, "");
switch (DBGetContactSettingByte(hContact, jabberProtoName, "Gender", '?')) {
case 'M':
SendDlgItemMessage(hwndDlg, IDC_GENDER, CB_SETCURSEL, 1, 0);
SetDlgItemText(hwndDlg, IDC_GENDER_TEXT, Translate(tlenFieldGender[0].name));
break;
case 'F':
SendDlgItemMessage(hwndDlg, IDC_GENDER, CB_SETCURSEL, 2, 0);
SetDlgItemText(hwndDlg, IDC_GENDER_TEXT, Translate(tlenFieldGender[1].name));
break;
default:
SendDlgItemMessage(hwndDlg, IDC_GENDER, CB_SETCURSEL, 0, 0);
SetDlgItemText(hwndDlg, IDC_GENDER_TEXT, "");
break;
}
i = DBGetContactSettingWord(hContact, jabberProtoName, "Occupation", 0);
if (i>0 && i<13) {
SetDlgItemText(hwndDlg, IDC_OCCUPATION_TEXT, Translate(tlenFieldOccupation[i-1].name));
SendDlgItemMessage(hwndDlg, IDC_OCCUPATION, CB_SETCURSEL, i, 0);
} else {
SetDlgItemText(hwndDlg, IDC_OCCUPATION_TEXT, "");
SendDlgItemMessage(hwndDlg, IDC_OCCUPATION, CB_SETCURSEL, 0, 0);
}
i = DBGetContactSettingWord(hContact, jabberProtoName, "LookingFor", 0);
if (i>0 && i<6) {
SetDlgItemText(hwndDlg, IDC_LOOKFOR_TEXT, Translate(tlenFieldLookfor[i-1].name));
SendDlgItemMessage(hwndDlg, IDC_LOOKFOR, CB_SETCURSEL, i, 0);
} else {
SetDlgItemText(hwndDlg, IDC_LOOKFOR_TEXT, "");
SendDlgItemMessage(hwndDlg, IDC_LOOKFOR, CB_SETCURSEL, 0, 0);
}
i = DBGetContactSettingWord(hContact, jabberProtoName, "VoiceChat", 0);
CheckDlgButton(hwndDlg, IDC_VOICECONVERSATIONS, i);
if (!DBGetContactSetting(hContact, jabberProtoName, "jid", &dbv)) {
jid = JabberTextDecode(dbv.pszVal);
SetDlgItemText(hwndDlg, IDC_INFO_JID, jid);
free(jid);
jid = dbv.pszVal;
if (jabberOnline) {
if ((item=JabberListGetItemPtr(LIST_ROSTER, jid)) != NULL) {
switch (item->subscription) {
case SUB_BOTH:
SetDlgItemText(hwndDlg, IDC_SUBSCRIPTION, Translate("both"));
break;
//.........这里部分代码省略.........
示例9: DlgProfileNew
static INT_PTR CALLBACK DlgProfileNew(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
struct DlgProfData * dat = (struct DlgProfData *)GetWindowLongPtr(hwndDlg,GWLP_USERDATA);
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault( hwndDlg );
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
dat = (struct DlgProfData *)lParam;
{
// fill in the db plugins present
PLUGIN_DB_ENUM dbe;
dbe.cbSize = sizeof(dbe);
dbe.pfnEnumCallback = (int(*)(const char*,void*,LPARAM))FindDbProviders;
dbe.lParam = (LPARAM)hwndDlg;
if ( CallService( MS_PLUGINS_ENUMDBPLUGINS, 0, ( LPARAM )&dbe ) == -1 ) {
// no plugins?!
EnableWindow( GetDlgItem(hwndDlg, IDC_PROFILEDRIVERS ), FALSE );
EnableWindow( GetDlgItem(hwndDlg, IDC_PROFILENAME ), FALSE );
ShowWindow( GetDlgItem(hwndDlg, IDC_NODBDRIVERS ), TRUE );
}
// default item
SendDlgItemMessage(hwndDlg, IDC_PROFILEDRIVERS, CB_SETCURSEL, 0, 0);
}
// subclass the profile name box
{
HWND hwndProfile = GetDlgItem(hwndDlg, IDC_PROFILENAME);
WNDPROC proc = (WNDPROC)GetWindowLongPtr(hwndProfile, GWLP_WNDPROC);
SetWindowLongPtr(hwndProfile,GWLP_USERDATA,(LONG_PTR)proc);
SetWindowLongPtr(hwndProfile,GWLP_WNDPROC,(LONG_PTR)ProfileNameValidate);
}
// decide if there is a default profile name given in the INI and if it should be used
if (dat->pd->noProfiles || (shouldAutoCreate(dat->pd->szProfile) && _taccess(dat->pd->szProfile, 0)))
{
TCHAR* profile = _tcsrchr(dat->pd->szProfile, '\\');
if (profile) ++profile;
else profile = dat->pd->szProfile;
TCHAR *p = _tcsrchr(profile, '.');
TCHAR c = 0;
if (p) { c = *p; *p = 0; }
SetDlgItemText(hwndDlg, IDC_PROFILENAME, profile);
if (c) *p = c;
}
// focus on the textbox
PostMessage( hwndDlg, WM_FOCUSTEXTBOX, 0, 0 );
return TRUE;
case WM_FOCUSTEXTBOX:
SetFocus( GetDlgItem( hwndDlg, IDC_PROFILENAME ));
break;
case WM_INPUTCHANGED: // when input in the edit box changes
SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
EnableWindow( dat->hwndOK, GetWindowTextLength( GetDlgItem( hwndDlg, IDC_PROFILENAME )) > 0 );
break;
case WM_SHOWWINDOW:
if ( wParam ) {
SetWindowText( dat->hwndOK, TranslateT("&Create"));
SendMessage( hwndDlg, WM_INPUTCHANGED, 0, 0 );
}
break;
case WM_NOTIFY:
{
NMHDR* hdr = ( NMHDR* )lParam;
if ( hdr && hdr->code == PSN_APPLY && dat && IsWindowVisible( hwndDlg )) {
TCHAR szName[MAX_PATH];
LRESULT curSel = SendDlgItemMessage(hwndDlg,IDC_PROFILEDRIVERS,CB_GETCURSEL,0,0);
if ( curSel == CB_ERR ) break; // should never happen
GetDlgItemText(hwndDlg, IDC_PROFILENAME, szName, SIZEOF( szName ));
if ( szName[0] == 0 )
break;
// profile placed in "profile_name" subfolder
mir_sntprintf( dat->pd->szProfile, MAX_PATH, _T("%s\\%s\\%s.dat"), dat->pd->szProfileDir, szName, szName );
dat->pd->newProfile = 1;
dat->pd->dblink = (DATABASELINK *)SendDlgItemMessage( hwndDlg, IDC_PROFILEDRIVERS, CB_GETITEMDATA, ( WPARAM )curSel, 0 );
if ( makeDatabase( dat->pd->szProfile, dat->pd->dblink, hwndDlg ) == 0 ) {
SetWindowLongPtr( hwndDlg, DWLP_MSGRESULT, PSNRET_INVALID_NOCHANGEPAGE );
} } }
break;
}
return FALSE;
}
示例10: DlgProfileSelect
static INT_PTR CALLBACK DlgProfileSelect(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
DlgProfData* dat = (struct DlgProfData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
HWND hwndList = GetDlgItem(hwndDlg, IDC_PROFILELIST);
switch (msg) {
case WM_INITDIALOG:
{
HIMAGELIST hImgList;
LVCOLUMN col;
TranslateDialogDefault( hwndDlg );
dat = (DlgProfData*) lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat);
// set columns
col.mask = LVCF_TEXT | LVCF_WIDTH;
col.pszText = TranslateT("Profile");
col.cx=122;
ListView_InsertColumn( hwndList, 0, &col );
col.pszText = TranslateT("Driver");
col.cx=100;
ListView_InsertColumn( hwndList, 1, &col );
col.pszText = TranslateT("Size");
col.cx=60;
ListView_InsertColumn( hwndList, 2, &col );
col.pszText = TranslateT("Created");
col.cx=145;
ListView_InsertColumn( hwndList, 3, &col );
col.pszText = TranslateT("Modified");
col.cx=145;
ListView_InsertColumn( hwndList, 4, &col );
// icons
hImgList = ImageList_Create(16, 16, ILC_MASK | (IsWinVerXPPlus() ? ILC_COLOR32 : ILC_COLOR16), 2, 1);
ImageList_AddIcon_NotShared(hImgList, MAKEINTRESOURCE(IDI_USERDETAILS));
ImageList_AddIcon_NotShared(hImgList, MAKEINTRESOURCE(IDI_DELETE));
// LV will destroy the image list
SetWindowLongPtr(hwndList, GWL_STYLE, GetWindowLongPtr(hwndList, GWL_STYLE) | LVS_SORTASCENDING);
ListView_SetImageList(hwndList, hImgList, LVSIL_SMALL);
ListView_SetExtendedListViewStyle(hwndList,
ListView_GetExtendedListViewStyle(hwndList) | LVS_EX_DOUBLEBUFFER | LVS_EX_LABELTIP | LVS_EX_FULLROWSELECT);
// find all the profiles
ProfileEnumData ped = { hwndDlg, dat->pd->szProfile };
findProfiles(dat->pd->szProfileDir, EnumProfilesForList, (LPARAM)&ped);
PostMessage(hwndDlg, WM_FOCUSTEXTBOX, 0, 0);
dat->hFileNotify = FindFirstChangeNotification(dat->pd->szProfileDir, TRUE,
FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_LAST_WRITE);
if (dat->hFileNotify != INVALID_HANDLE_VALUE)
SetTimer(hwndDlg, 0, 1200, NULL);
return TRUE;
}
case WM_DESTROY:
KillTimer(hwndDlg, 0);
FindCloseChangeNotification(dat->hFileNotify);
break;
case WM_TIMER:
if (WaitForSingleObject(dat->hFileNotify, 0) == WAIT_OBJECT_0)
{
ListView_DeleteAllItems(hwndList);
ProfileEnumData ped = { hwndDlg, dat->pd->szProfile };
findProfiles(dat->pd->szProfileDir, EnumProfilesForList, (LPARAM)&ped);
FindNextChangeNotification(dat->hFileNotify);
}
break;
case WM_FOCUSTEXTBOX:
SetFocus(hwndList);
if (dat->pd->szProfile[0] == 0 || ListView_GetSelectedCount(hwndList) == 0)
ListView_SetItemState(hwndList, 0, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
break;
case WM_SHOWWINDOW:
if ( wParam )
{
SetWindowText(dat->hwndOK, TranslateT("&Run"));
EnableWindow(dat->hwndOK, ListView_GetSelectedCount(hwndList)==1);
}
break;
case WM_CONTEXTMENU:
{
LVHITTESTINFO lvht = {0};
lvht.pt.x = GET_X_LPARAM(lParam);
lvht.pt.y = GET_Y_LPARAM(lParam);
ScreenToClient(hwndList, &lvht.pt);
if (ListView_HitTest(hwndList, &lvht) < 0) break;
lvht.pt.x = GET_X_LPARAM(lParam);
lvht.pt.y = GET_Y_LPARAM(lParam);
//.........这里部分代码省略.........
示例11: MraPopupDlgProcOpts
INT_PTR CALLBACK MraPopupDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
CMraProto *ppro = (CMraProto*)GetWindowLongPtr(hWndDlg, GWLP_USERDATA);
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hWndDlg);
SetWindowLongPtr(hWndDlg, GWLP_USERDATA, lParam);
ppro = (CMraProto*)lParam;
{
HWND hWndCombo = GetDlgItem(hWndDlg, IDC_COMBO_POPUP_TYPE);
SendMessage(hWndCombo, CB_RESETCONTENT, 0, 0);
for (size_t i = 0; i < POPUPS_TYPES_COUNT; i++) {
DWORD dwItem = SendMessage(hWndCombo, CB_ADDSTRING, 0, (LPARAM)TranslateTS(lpcwszPopupsTypes[i]));
SendMessage(hWndCombo, CB_SETITEMDATA, dwItem, i);
}
SendMessage(hWndCombo, CB_SETCURSEL, 0, 0);
SendMessage(hWndDlg, WM_COMMAND, MAKELONG(IDC_COMBO_POPUP_TYPE, CBN_SELCHANGE), 0);
}
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_COMBO_POPUP_TYPE:
if (HIWORD(wParam) == CBN_SELCHANGE) {
BOOL bEnabled, bUseWinColors;
char szBuff[MAX_PATH];
DWORD dwType = GET_CURRENT_COMBO_DATA(hWndDlg, IDC_COMBO_POPUP_TYPE);
bEnabled = GetBit(ppro->getDword("PopupsEventFilter", MRA_DEFAULT_POPUPS_EVENT_FILTER), dwType);
CheckDlgButton(hWndDlg, IDC_CHK_ENABLE, bEnabled);
mir_snprintf(szBuff, SIZEOF(szBuff), "PopupType%SUseWinColors", lpcwszPopupsTypes[dwType]);
bUseWinColors = ppro->getByte(szBuff, MRA_DEFAULT_POPUP_USE_WIN_COLORS);
CheckDlgButton(hWndDlg, IDC_CHK_USE_WIN_COLORS, bUseWinColors);
EnableWindow(GetDlgItem(hWndDlg, IDC_CHK_USE_WIN_COLORS), bEnabled);
mir_snprintf(szBuff, SIZEOF(szBuff), "PopupType%SColorBack", lpcwszPopupsTypes[dwType]);
SendDlgItemMessage(hWndDlg, IDC_POPUP_BACKCOLOR, CPM_SETCOLOUR, 0, ppro->getDword(szBuff, MRA_DEFAULT_POPUP_COLOR_BACK));
EnableWindow(GetDlgItem(hWndDlg, IDC_POPUP_BACKCOLOR), (bEnabled && bUseWinColors == FALSE));
mir_snprintf(szBuff, SIZEOF(szBuff), "PopupType%SColorText", lpcwszPopupsTypes[dwType]);
SendDlgItemMessage(hWndDlg, IDC_POPUP_TEXTCOLOR, CPM_SETCOLOUR, 0, ppro->getDword(szBuff, MRA_DEFAULT_POPUP_COLOR_TEXT));
EnableWindow(GetDlgItem(hWndDlg, IDC_POPUP_TEXTCOLOR), (bEnabled && bUseWinColors == FALSE));
mir_snprintf(szBuff, SIZEOF(szBuff), "PopupType%STimeout", lpcwszPopupsTypes[dwType]);
SetDlgItemInt(hWndDlg, IDC_POPUP_TIMEOUT, ppro->getDword(szBuff, MRA_DEFAULT_POPUP_TIMEOUT), FALSE);
EnableWindow(GetDlgItem(hWndDlg, IDC_POPUP_TIMEOUT), bEnabled);
}
break;
case IDC_PREVIEW:
{
for (size_t i = 0; i < POPUPS_TYPES_COUNT; i++) {
ppro->MraPopupShowFromAgentW(i, 0, TranslateTS(lpcwszPopupsTypes[i]));
}
}
break;
case IDC_CHK_ENABLE:
case IDC_CHK_USE_WIN_COLORS:
{
BOOL bEnabled = IsDlgButtonChecked(hWndDlg, IDC_CHK_ENABLE);
BOOL bUseWinColors = IsDlgButtonChecked(hWndDlg, IDC_CHK_USE_WIN_COLORS);
EnableWindow(GetDlgItem(hWndDlg, IDC_CHK_USE_WIN_COLORS), bEnabled);
EnableWindow(GetDlgItem(hWndDlg, IDC_POPUP_BACKCOLOR), (bEnabled && bUseWinColors == FALSE));
EnableWindow(GetDlgItem(hWndDlg, IDC_POPUP_TEXTCOLOR), (bEnabled && bUseWinColors == FALSE));
EnableWindow(GetDlgItem(hWndDlg, IDC_POPUP_TIMEOUT), bEnabled);
}
default:
if ((LOWORD(wParam) == IDC_POPUP_TIMEOUT) && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()))
return FALSE;
SendMessage(GetParent(hWndDlg), PSM_CHANGED, 0, 0);
}
break;
case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
{
char szBuff[MAX_PATH];
DWORD dwType = GET_CURRENT_COMBO_DATA(hWndDlg, IDC_COMBO_POPUP_TYPE);
DWORD dwPopupsEventFilter = ppro->getDword("PopupsEventFilter", MRA_DEFAULT_POPUPS_EVENT_FILTER);
if (IsDlgButtonChecked(hWndDlg, IDC_CHK_ENABLE))
dwPopupsEventFilter |= (1<<dwType);
else
dwPopupsEventFilter &= ~(1<<dwType);
ppro->setDword("PopupsEventFilter", dwPopupsEventFilter);
mir_snprintf(szBuff, SIZEOF(szBuff), "PopupType%SUseWinColors", lpcwszPopupsTypes[dwType]);
ppro->setByte(szBuff, IsDlgButtonChecked(hWndDlg, IDC_CHK_USE_WIN_COLORS));
mir_snprintf(szBuff, SIZEOF(szBuff), "PopupType%SColorBack", lpcwszPopupsTypes[dwType]);
ppro->setDword(szBuff, SendDlgItemMessage(hWndDlg, IDC_POPUP_BACKCOLOR, CPM_GETCOLOUR, 0, 0));
mir_snprintf(szBuff, SIZEOF(szBuff), "PopupType%SColorText", lpcwszPopupsTypes[dwType]);
ppro->setDword(szBuff, SendDlgItemMessage(hWndDlg, IDC_POPUP_TEXTCOLOR, CPM_GETCOLOUR, 0, 0));
//.........这里部分代码省略.........
示例12: IgnoreDialogProc
// dialog procedure for handling the contact ignore dialog (available from the contact menu
static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hWnd, GWLP_USERDATA);
switch (msg) {
case WM_INITDIALOG:
{
DWORD dwMask;
ClcContact *contact = NULL;
int pCaps;
HWND hwndAdd;
hContact = lParam;
SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)hContact);
dwMask = cfg::getDword(hContact, "Ignore", "Mask1", 0);
SendMessage(hWnd, WM_USER + 100, hContact, dwMask);
SendMessage(hWnd, WM_USER + 120, 0, 0);
TranslateDialogDefault(hWnd);
hwndAdd = GetDlgItem(hWnd, IDC_IGN_ADDPERMANENTLY); // CreateWindowEx(0, _T("CLCButtonClass"), _T("FOO"), WS_VISIBLE | BS_PUSHBUTTON | WS_CHILD | WS_TABSTOP, 200, 276, 106, 24, hWnd, (HMENU)IDC_IGN_ADDPERMANENTLY, g_hInst, NULL);
CustomizeButton(hwndAdd, false, true, false);
SendMessage(hwndAdd, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadSkinnedIcon(SKINICON_OTHER_ADDCONTACT));
SetWindowText(hwndAdd, TranslateT("Add permanently"));
EnableWindow(hwndAdd, cfg::getByte(hContact, "CList", "NotOnList", 0));
hwndAdd = GetDlgItem(hWnd, IDC_DSP_LOADDEFAULT); // CreateWindowEx(0, _T("CLCButtonClass"), _T("FOO"), WS_VISIBLE | BS_PUSHBUTTON | WS_CHILD | WS_TABSTOP, 200, 276, 106, 24, hWnd, (HMENU)IDC_IGN_ADDPERMANENTLY, g_hInst, NULL);
CustomizeButton(hwndAdd, false, true, false);
SendMessage(hwndAdd, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadSkinnedIcon(SKINICON_OTHER_DELETE));
SetWindowText(hwndAdd, TranslateT("Revert to default"));
EnableWindow(hwndAdd, TRUE);
SendDlgItemMessage(hWnd, IDC_AVATARDISPMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Default (global setting)"));
SendDlgItemMessage(hWnd, IDC_AVATARDISPMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Show always when available"));
SendDlgItemMessage(hWnd, IDC_AVATARDISPMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Hide always"));
SendDlgItemMessage(hWnd, IDC_SECONDLINEMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Default (global setting)"));
SendDlgItemMessage(hWnd, IDC_SECONDLINEMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Never"));
SendDlgItemMessage(hWnd, IDC_SECONDLINEMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Always"));
SendDlgItemMessage(hWnd, IDC_SECONDLINEMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("When space is available"));
SendDlgItemMessage(hWnd, IDC_SECONDLINEMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("When needed by status message"));
if (cfg::clcdat) {
FindItem(pcli->hwndContactTree, cfg::clcdat, (HANDLE)hContact, &contact, NULL, NULL);
if (contact && contact->type != CLCIT_CONTACT) {
DestroyWindow(hWnd);
return FALSE;
}
else {
TCHAR szTitle[512];
DWORD dwFlags = cfg::getDword(hContact, "CList", "CLN_Flags", 0);
BYTE bSecondLine = cfg::getByte(hContact, "CList", "CLN_2ndline", -1);
DWORD dwXMask = cfg::getDword(hContact, "CList", "CLN_xmask", 0);
int i = 0;
mir_sntprintf(szTitle, 512, TranslateT("Contact list display and ignore options for %s"), contact ? contact->szText : (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR));
SetWindowText(hWnd, szTitle);
SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)LoadSkinnedIcon(SKINICON_OTHER_MIRANDA));
pCaps = CallProtoService(contact ? contact->proto : GetContactProto(hContact), PS_GETCAPS, PFLAGNUM_1, 0);
Utils::enableDlgControl(hWnd, IDC_IGN_ALWAYSONLINE, pCaps & PF1_INVISLIST ? TRUE : FALSE);
Utils::enableDlgControl(hWnd, IDC_IGN_ALWAYSOFFLINE, pCaps & PF1_VISLIST ? TRUE : FALSE);
CheckDlgButton(hWnd, IDC_IGN_PRIORITY, cfg::getByte(hContact, "CList", "Priority", 0) ? 1 : 0);
Utils::enableDlgControl(hWnd, IDC_IGN_PRIORITY, TRUE);
Utils::enableDlgControl(hWnd, IDC_AVATARDISPMODE, TRUE);
Utils::enableDlgControl(hWnd, IDC_SECONDLINEMODE, TRUE);
if (dwFlags & ECF_FORCEAVATAR)
SendDlgItemMessage(hWnd, IDC_AVATARDISPMODE, CB_SETCURSEL, 1, 0);
else if (dwFlags & ECF_HIDEAVATAR)
SendDlgItemMessage(hWnd, IDC_AVATARDISPMODE, CB_SETCURSEL, 2, 0);
else
SendDlgItemMessage(hWnd, IDC_AVATARDISPMODE, CB_SETCURSEL, 0, 0);
if (dwFlags & ECF_FORCEOVERLAY)
SendDlgItemMessage(hWnd, IDC_OVERLAYICON, BM_SETCHECK, BST_CHECKED, 0);
else if (dwFlags & ECF_HIDEOVERLAY)
SendDlgItemMessage(hWnd, IDC_OVERLAYICON, BM_SETCHECK, BST_UNCHECKED, 0);
else
SendDlgItemMessage(hWnd, IDC_OVERLAYICON, BM_SETCHECK, BST_INDETERMINATE, 0);
if (dwFlags & ECF_FORCELOCALTIME)
SendDlgItemMessage(hWnd, IDC_SHOWLOCALTIME1, BM_SETCHECK, BST_CHECKED, 0);
else if (dwFlags & ECF_HIDELOCALTIME)
SendDlgItemMessage(hWnd, IDC_SHOWLOCALTIME1, BM_SETCHECK, BST_UNCHECKED, 0);
else
SendDlgItemMessage(hWnd, IDC_SHOWLOCALTIME1, BM_SETCHECK, BST_INDETERMINATE, 0);
if (bSecondLine == 0xff)
SendDlgItemMessage(hWnd, IDC_SECONDLINEMODE, CB_SETCURSEL, 0, 0);
else
SendDlgItemMessage(hWnd, IDC_SECONDLINEMODE, CB_SETCURSEL, (WPARAM)(bSecondLine + 1), 0);
}
}
WindowList_Add(hWindowListIGN, hWnd, hContact);
ShowWindow(hWnd, SW_SHOWNORMAL);
}
return TRUE;
case WM_COMMAND:
//.........这里部分代码省略.........
示例13: DlgProcKeyBindingsOpts
BOOL CALLBACK DlgProcKeyBindingsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
case WM_INITDIALOG:
{
TranslateDialogDefault(hwndDlg);
OldEditProc = (WNDPROC) SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_PREVIEW), GWLP_WNDPROC, (LONG_PTR) KeyBindingsEditProc);
currentTreeItem = NULL;
loadTempKeyBindings();
buildTree(GetDlgItem(hwndDlg, IDC_CATEGORYLIST));
EnableWindow(GetDlgItem(hwndDlg, IDC_ADD), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE), FALSE);
}
return TRUE;
case WM_KEYDOWN:
case WM_SYSKEYDOWN:
SendDlgItemMessage(hwndDlg, IDC_PREVIEW, msg, wParam, lParam);
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_ADD:
if (currentTreeItem->keyBinding != NULL) {
int i;
removeTempKeyBinding(currentTreeItem->keyBinding->actionGroupName, modifiers | virtualKey);
for (i=0; i<5; i++) {
if (currentTreeItem->keyBinding->tempKey[i] == 0) {
currentTreeItem->keyBinding->tempKey[i] = modifiers | virtualKey;
break;
}
}
}
refreshListBox(hwndDlg);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case IDC_DELETE:
if (currentTreeItem->keyBinding != NULL) {
int index = SendDlgItemMessage(hwndDlg, IDC_LIST, LB_GETCURSEL, 0, 0);
if (index != LB_ERR && index <5) {
if (currentTreeItem->keyBinding->tempKey[index] != 0) {
int i;
for (i = index + 1; i < 5; i++) {
currentTreeItem->keyBinding->tempKey[i-1] = currentTreeItem->keyBinding->tempKey[i];
}
currentTreeItem->keyBinding->tempKey[4] = 0;
}
}
}
refreshListBox(hwndDlg);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case IDC_BTN_RESET:
if (currentTreeItem->keyBinding != NULL) {
int i;
for (i = 0; i < 5; i++) {
removeTempKeyBinding(currentTreeItem->keyBinding->actionGroupName, currentTreeItem->keyBinding->defaultKey[i]);
currentTreeItem->keyBinding->tempKey[i] = currentTreeItem->keyBinding->defaultKey[i];
}
}
refreshListBox(hwndDlg);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case IDC_BTN_UNDO:
if (currentTreeItem->keyBinding != NULL) {
int i;
for (i = 0; i < 5; i++) {
removeTempKeyBinding(currentTreeItem->keyBinding->actionGroupName, currentTreeItem->keyBinding->key[i]);
currentTreeItem->keyBinding->tempKey[i] = currentTreeItem->keyBinding->key[i];
}
}
refreshListBox(hwndDlg);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case IDC_LIST:
if (HIWORD(wParam) == LBN_SELCHANGE) {
EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE), TRUE);
}
break;
}
break;
case WM_NOTIFY:
if (((LPNMHDR) lParam)->idFrom == IDC_CATEGORYLIST)
{
switch(((NMHDR*)lParam)->code) {
case TVN_SELCHANGEDA:
case TVN_SELCHANGEDW:
{
TVITEM tvi = {0};
tvi.hItem = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_CATEGORYLIST));
tvi.mask = TVIF_HANDLE|TVIF_PARAM;
TreeView_GetItem(GetDlgItem(hwndDlg, IDC_CATEGORYLIST), &tvi);
currentTreeItem = (TreeItem *) tvi.lParam;
refreshListBox(hwndDlg);
break;
}
case TVN_DELETEITEMA:
case TVN_DELETEITEMW:
{
TreeItem *treeItem = (TreeItem *)(((LPNMTREEVIEW)lParam)->itemOld.lParam);
if (treeItem) {
//.........这里部分代码省略.........
示例14: DlgProcSoundUIPage
INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
static HANDLE hContact = NULL;
switch (msg)
{
case WM_INITDIALOG:
{
TranslateDialogDefault(hwndDlg);
hContact = (HANDLE)lParam;
char *szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
HWND hList = GetDlgItem(hwndDlg, IDC_INDSNDLIST);
ListView_SetImageList(hList, GetStatusIconsImgList(szProto), LVSIL_SMALL);
ListView_SetExtendedListViewStyleEx(hList, LVS_EX_FULLROWSELECT | LVS_EX_INFOTIP, LVS_EX_FULLROWSELECT | LVS_EX_INFOTIP);
RECT rc = {0};
GetClientRect(hList, &rc);
LV_COLUMN lvc = {0};
lvc.mask = LVCF_WIDTH | LVCF_TEXT;
lvc.cx = STATUS_COLUMN;
lvc.pszText = TranslateT("Status");
ListView_InsertColumn(hList, 0, &lvc);
lvc.cx = rc.right - STATUS_COLUMN - GetSystemMetrics(SM_CXVSCROLL);
lvc.pszText = TranslateT("Sound for the status");
ListView_InsertColumn(hList, 1, &lvc);
if (szProto)
{
DBVARIANT dbv;
TCHAR buff[MAX_PATH];
for (int i = ID_STATUS_MAX; i >= ID_STATUS_MIN; i--)
{
int flags = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_2, 0);
if (flags == 0)
flags = PF2_ONLINE|PF2_INVISIBLE|PF2_SHORTAWAY|PF2_LONGAWAY|PF2_LIGHTDND|PF2_HEAVYDND|PF2_FREECHAT|PF2_OUTTOLUNCH|PF2_ONTHEPHONE;
if ((flags & Proto_Status2Flag(i)) || i == ID_STATUS_OFFLINE)
{
LV_ITEM lvi = {0};
lvi.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE;
lvi.iItem = 0;
lvi.iSubItem = 0;
lvi.iImage = Index(i);
lvi.lParam = (LPARAM)i;
lvi.pszText = TranslateTS(StatusList[Index(i)].lpzStandardText);
lvi.iItem = ListView_InsertItem(hList, &lvi);
if (!DBGetContactSettingTString(hContact, MODULE, StatusList[Index(i)].lpzSkinSoundName, &dbv))
{
_tcscpy(buff, dbv.ptszVal);
DBFreeVariant(&dbv);
}
else
_tcscpy(buff, TranslateT(DEFAULT_SOUND));
ListView_SetItemText(hList, lvi.iItem, 1, buff);
}
}
LV_ITEM lvi = {0};
lvi.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE;
lvi.iItem = 0;
lvi.iSubItem = 0;
lvi.iImage = Index(ID_STATUS_MAX) + 1; // additional icon
lvi.lParam = (LPARAM)ID_STATUS_FROMOFFLINE;
lvi.pszText = TranslateT("From offline");
lvi.iItem = ListView_InsertItem(hList, &lvi);
if (!DBGetContactSettingTString(hContact, MODULE, "UserFromOffline", &dbv))
{
_tcscpy(buff, dbv.ptszVal);
DBFreeVariant(&dbv);
}
else
_tcscpy(buff, TranslateT(DEFAULT_SOUND));
ListView_SetItemText(hList, lvi.iItem, 1, buff);
}
CheckDlgButton(hwndDlg, IDC_CHECK_NOTIFYSOUNDS, DBGetContactSettingByte(hContact, MODULE, "EnableSounds", 1));
CheckDlgButton(hwndDlg, IDC_CHECK_NOTIFYPOPUPS, DBGetContactSettingByte(hContact, MODULE, "EnablePopups", 1));
ShowWindow(GetDlgItem(hwndDlg, IDC_INDSNDLIST), opt.UseIndSnd ? SW_SHOW : SW_HIDE);
ShowWindow(GetDlgItem(hwndDlg, IDC_TEXT_ENABLE_IS), opt.UseIndSnd ? SW_HIDE : SW_SHOW);
ShowWindow(GetDlgItem(hwndDlg, IDC_CHANGE), opt.UseIndSnd ? SW_SHOW : SW_HIDE);
ShowWindow(GetDlgItem(hwndDlg, IDC_PREVIEW), opt.UseIndSnd ? SW_SHOW : SW_HIDE);
ShowWindow(GetDlgItem(hwndDlg, IDC_DELETE), opt.UseIndSnd ? SW_SHOW : SW_HIDE);
return TRUE;
}
case WM_COMMAND:
{
switch (LOWORD(wParam))
{
case IDC_PREVIEW:
{
//.........这里部分代码省略.........
示例15: DlgProcFiltering
INT_PTR CALLBACK DlgProcFiltering(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
static HANDLE hItemAll;
switch (msg)
{
case WM_INITDIALOG:
{
TranslateDialogDefault(hwndDlg);
HIMAGELIST hImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), IsWinVerXPPlus() ? ILC_COLOR32 : ILC_COLOR16 | ILC_MASK, 3, 3);
ImageList_AddIcon(hImageList, LoadIcon(hInst,MAKEINTRESOURCE(IDI_SOUND)));
SendDlgItemMessage(hwndDlg,IDC_SOUNDICON,STM_SETICON, (WPARAM)ImageList_GetIcon(hImageList, EXTRA_IMAGE_SOUND, ILD_NORMAL), 0);
ImageList_AddIcon(hImageList, LoadIcon(hInst, MAKEINTRESOURCE(IDI_POPUP)));
SendDlgItemMessage(hwndDlg, IDC_POPUPICON, STM_SETICON, (WPARAM)ImageList_GetIcon(hImageList, EXTRA_IMAGE_POPUP, ILD_NORMAL), 0);
ImageList_AddIcon(hImageList, LoadIcon(hInst,MAKEINTRESOURCE(IDI_XSTATUS)));
SendDlgItemMessage(hwndDlg, IDC_XSTATUSICON, STM_SETICON, (WPARAM)ImageList_GetIcon(hImageList, EXTRA_IMAGE_XSTATUS, ILD_NORMAL), 0);
ImageList_AddIcon(hImageList, LoadIcon(hInst,MAKEINTRESOURCE(IDI_LOGGING)));
SendDlgItemMessage(hwndDlg, IDC_LOGGINGICON, STM_SETICON, (WPARAM)ImageList_GetIcon(hImageList, EXTRA_IMAGE_LOGGING, ILD_NORMAL), 0);
ImageList_AddIcon(hImageList, LoadIcon(hInst,MAKEINTRESOURCE(IDI_DISABLEALL)));
SendDlgItemMessage(hwndDlg, IDC_DISABLEALLICON, STM_SETICON, (WPARAM)ImageList_GetIcon(hImageList, EXTRA_IMAGE_DISABLEALL, ILD_NORMAL), 0);
ImageList_AddIcon(hImageList, LoadIcon(hInst,MAKEINTRESOURCE(IDI_ENABLEALL)));
SendDlgItemMessage(hwndDlg, IDC_ENABLEALLICON, STM_SETICON, (WPARAM)ImageList_GetIcon(hImageList, EXTRA_IMAGE_ENABLEALL, ILD_NORMAL), 0);
ImageList_AddIcon(hImageList, LoadSkinnedIcon(SKINICON_OTHER_SMALLDOT));
SendDlgItemMessage(hwndDlg, IDC_INDSNDLIST, CLM_SETEXTRAIMAGELIST, 0, (LPARAM)hImageList);
SendDlgItemMessage(hwndDlg, IDC_INDSNDLIST, CLM_SETEXTRACOLUMNS, 6, 0);
HWND hList = GetDlgItem(hwndDlg, IDC_INDSNDLIST);
ResetListOptions(hList);
CLCINFOITEM cii = {0};
cii.cbSize = sizeof(cii);
cii.flags = CLCIIF_GROUPFONT;
cii.pszText = TranslateT("** All contacts **");
hItemAll = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_INDSNDLIST, CLM_ADDINFOITEM, 0, (LPARAM)&cii);
return TRUE;
}
case WM_SETFOCUS:
{
SetFocus(GetDlgItem(hwndDlg, IDC_INDSNDLIST));
break;
}
case WM_NOTIFY:
{
HWND hList = GetDlgItem(hwndDlg, IDC_INDSNDLIST);
switch(((LPNMHDR)lParam)->idFrom)
{
case IDC_INDSNDLIST:
switch (((LPNMHDR)lParam)->code)
{
case CLN_NEWCONTACT:
case CLN_LISTREBUILT:
SetAllContactsIcons(hList);
//fall through
case CLN_CONTACTMOVED:
SetGroupsIcons(hList, (HANDLE)SendMessage(hList, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, NULL);
break;
case CLN_OPTIONSCHANGED:
ResetListOptions(hList);
break;
case NM_CLICK:
{
NMCLISTCONTROL *nm = (NMCLISTCONTROL*)lParam;
DWORD hitFlags;
// Make sure we have an extra column
if (nm->iColumn == -1) break;
// Find clicked item
HANDLE hItem = (HANDLE)SendMessage(hList, CLM_HITTEST, (WPARAM)&hitFlags, MAKELPARAM(nm->pt.x, nm->pt.y));
if (hItem == NULL) break;
if(!(hitFlags & CLCHT_ONITEMEXTRA)) break;
int itemType = SendMessage(hList, CLM_GETITEMTYPE, (WPARAM)hItem, 0);
// Get image in clicked column
int image = GetExtraImage(hList, hItem, nm->iColumn);
if (image == EXTRA_IMAGE_DOT)
image = nm->iColumn;
else if (image >= EXTRA_IMAGE_SOUND && image <= EXTRA_IMAGE_LOGGING)
image = EXTRA_IMAGE_DOT;
// Get item type (contact, group, etc...)
if (itemType == CLCIT_CONTACT)
{
if (image == EXTRA_IMAGE_DISABLEALL)
{
for (int i = 0; i < 4; i++)
SetExtraImage(hList, hItem, i, EXTRA_IMAGE_DOT);
}
else if (image == EXTRA_IMAGE_ENABLEALL)
{
for (int i = 0; i < 4; i++)
SetExtraImage(hList, hItem, i, i);
}
else
{
//.........这里部分代码省略.........