本文整理汇总了C++中CMsnProto::LoadOptions方法的典型用法代码示例。如果您正苦于以下问题:C++ CMsnProto::LoadOptions方法的具体用法?C++ CMsnProto::LoadOptions怎么用?C++ CMsnProto::LoadOptions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMsnProto
的用法示例。
在下文中一共展示了CMsnProto::LoadOptions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DlgProcHotmailPopupOpts
static INT_PTR CALLBACK DlgProcHotmailPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
static bool bEnabled;
CMsnProto* proto = (CMsnProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
bEnabled = false;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
proto = (CMsnProto*)lParam;
CheckDlgButton(hwndDlg, IDC_DISABLEHOTMAILPOPUP, proto->getByte("DisableHotmail", 0) ? BST_UNCHECKED : BST_CHECKED);
CheckDlgButton(hwndDlg, IDC_DISABLEHOTMAILTRAY, proto->getByte("DisableHotmailTray", 1) ? BST_UNCHECKED : BST_CHECKED);
CheckDlgButton(hwndDlg, IDC_DISABLEHOTMAILCL, proto->getByte("DisableHotmailCL", 0) ? BST_UNCHECKED : BST_CHECKED);
CheckDlgButton(hwndDlg, IDC_DISABLEHOTJUNK, proto->getByte("DisableHotmailJunk", 0) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_NOTIFY_ENDSESSION, proto->getByte("EnableSessionPopup", 0) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_NOTIFY_FIRSTMSG, proto->getByte("EnableDeliveryPopup", 0) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_ERRORS_USING_POPUPS, proto->getByte("ShowErrorsAsPopups", 0) ? BST_CHECKED : BST_UNCHECKED);
bEnabled = true;
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_DISABLEHOTMAILPOPUP:
case IDC_DISABLEHOTMAILTRAY:
case IDC_DISABLEHOTMAILCL:
case IDC_DISABLEHOTJUNK:
case IDC_NOTIFY_ENDSESSION:
case IDC_NOTIFY_FIRSTMSG:
case IDC_ERRORS_USING_POPUPS:
if (bEnabled)
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
}
break;
case WM_NOTIFY: //Here we have pressed either the OK or the APPLY button.
switch (((LPNMHDR)lParam)->idFrom) {
case 0:
switch (((LPNMHDR)lParam)->code) {
case PSN_RESET:
proto->LoadOptions();
return TRUE;
case PSN_APPLY:
proto->MyOptions.ShowErrorsAsPopups = IsDlgButtonChecked(hwndDlg, IDC_ERRORS_USING_POPUPS) != 0;
proto->setByte("ShowErrorsAsPopups", proto->MyOptions.ShowErrorsAsPopups);
proto->setByte("DisableHotmail", IsDlgButtonChecked(hwndDlg, IDC_DISABLEHOTMAILPOPUP) ? FALSE : TRUE);
proto->setByte("DisableHotmailCL", IsDlgButtonChecked(hwndDlg, IDC_DISABLEHOTMAILCL) ? FALSE : TRUE);
proto->setByte("DisableHotmailTray", IsDlgButtonChecked(hwndDlg, IDC_DISABLEHOTMAILTRAY) ? FALSE : TRUE);
proto->setByte("DisableHotmailJunk", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DISABLEHOTJUNK));
proto->setByte("EnableDeliveryPopup", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_NOTIFY_FIRSTMSG));
proto->setByte("EnableSessionPopup", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_NOTIFY_ENDSESSION));
MCONTACT hContact = proto->MSN_HContactFromEmail(proto->MyOptions.szEmail);
if (hContact)
proto->displayEmailCount(hContact);
return TRUE;
}
break;
}
break;
}
return FALSE;
}
示例2: CheckDlgButton
//.........这里部分代码省略.........
tSelectLen += mir_strlen(szFile);
OPENFILENAMEA ofn = { 0 };
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hwndDlg;
ofn.nMaxFile = _countof(szFile);
ofn.lpstrFile = szFile;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR;
if (GetOpenFileNameA(&ofn) != TRUE)
break;
if (strchr(szFile, ' ') != NULL) {
char tmpBuf[MAX_PATH + 2];
mir_snprintf(tmpBuf, _countof(tmpBuf), "\"%s\"", szFile);
mir_strcpy(szFile, tmpBuf);
}
SendMessage(tEditField, EM_SETSEL, 0, tSelectLen);
SendMessageA(tEditField, EM_REPLACESEL, TRUE, LPARAM(szFile));
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
}
}
break;
case WM_NOTIFY:
if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY) {
bool reconnectRequired = false;
TCHAR screenStr[MAX_PATH];
char password[100], szEmail[MSN_MAX_EMAIL_LEN];
DBVARIANT dbv;
CMsnProto* proto = (CMsnProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
GetDlgItemTextA(hwndDlg, IDC_HANDLE, szEmail, _countof(szEmail));
if (mir_strcmp(_strlwr(szEmail), proto->MyOptions.szEmail)) {
reconnectRequired = true;
mir_strcpy(proto->MyOptions.szEmail, szEmail);
proto->setString("e-mail", szEmail);
proto->setString("wlid", szEmail);
proto->setDword("netId", (proto->MyOptions.netId = proto->GetMyNetID()));
}
GetDlgItemTextA(hwndDlg, IDC_PASSWORD, password, _countof(password));
if (!proto->getString("Password", &dbv)) {
if (mir_strcmp(password, dbv.pszVal)) {
reconnectRequired = true;
proto->setString("Password", password);
}
db_free(&dbv);
}
else {
reconnectRequired = true;
proto->setString("Password", password);
}
#ifdef OBSOLETE
GetDlgItemText(hwndDlg, IDC_HANDLE2, screenStr, _countof(screenStr));
if (!proto->getTString("Nick", &dbv)) {
if (mir_tstrcmp(dbv.ptszVal, screenStr))
proto->MSN_SendNickname(screenStr);
db_free(&dbv);
}
else proto->MSN_SendNickname(screenStr);
BYTE mblsnd = IsDlgButtonChecked(hwndDlg, IDC_MOBILESEND) == BST_CHECKED;
if (mblsnd != proto->getByte("MobileAllowed", 0)) {
proto->msnNsThread->sendPacket("PRP", "MOB %c", mblsnd ? 'Y' : 'N');
proto->MSN_SetServerStatus(proto->m_iStatus);
}
unsigned tValue = IsDlgButtonChecked(hwndDlg, IDC_DISABLE_ANOTHER_CONTACTS);
if (tValue != proto->msnOtherContactsBlocked && proto->msnLoggedIn) {
proto->msnOtherContactsBlocked = tValue;
proto->msnNsThread->sendPacket("BLP", tValue ? "BL" : "AL");
proto->MSN_ABUpdateAttr(NULL, "MSN.IM.BLP", tValue ? "0" : "1");
break;
}
#endif
proto->setByte("SendFontInfo", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SENDFONTINFO));
proto->setByte("RunMailerOnHotmail", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_RUN_APP_ON_HOTMAIL));
proto->setByte("ManageServer", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_MANAGEGROUPS));
GetDlgItemText(hwndDlg, IDC_MAILER_APP, screenStr, _countof(screenStr));
proto->setTString("MailerPath", screenStr);
if (reconnectRequired && proto->msnLoggedIn)
MessageBox(hwndDlg,
TranslateT("The changes you have made require you to reconnect to the MSN Messenger network before they take effect"),
TranslateT("MSN Options"), MB_OK);
proto->LoadOptions();
return TRUE;
}
break;
}
return FALSE;
}
示例3: SetDlgItemTextA
//.........这里部分代码省略.........
if (db_get_static(NULL, proto->m_szModuleName, "YourHost", ipaddr, sizeof(ipaddr)))
gethst = 0;
if (gethst == 0)
strncpy_s(ipaddr, (proto->msnLoggedIn ? proto->MyConnection.GetMyExtIPStr() : ""), _TRUNCATE);
SendDlgItemMessage(hwndDlg, IDC_HOSTOPT, CB_SETCURSEL, gethst, 0);
if (ipaddr[0])
SetDlgItemTextA(hwndDlg, IDC_YOURHOST, ipaddr);
else
SetDlgItemText(hwndDlg, IDC_YOURHOST, TranslateT("IP info available only after login"));
EnableWindow(GetDlgItem(hwndDlg, IDC_YOURHOST), gethst == 1);
}
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_RESETSERVER:
SetDlgItemTextA(hwndDlg, IDC_DIRECTSERVER, MSN_DEFAULT_LOGIN_SERVER);
SetDlgItemTextA(hwndDlg, IDC_GATEWAYSERVER, MSN_DEFAULT_GATEWAY);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
}
if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus())
switch (LOWORD(wParam)) {
case IDC_DIRECTSERVER:
case IDC_GATEWAYSERVER:
case IDC_YOURHOST:
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
if (HIWORD(wParam) == CBN_SELCHANGE && LOWORD(wParam) == IDC_HOSTOPT) {
unsigned gethst = SendMessage((HWND)lParam, CB_GETCURSEL, 0, 0);
EnableWindow(GetDlgItem(hwndDlg, IDC_YOURHOST), gethst == 1);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
if (HIWORD(wParam) == BN_CLICKED) {
switch (LOWORD(wParam)) {
case IDC_SLOWSEND:
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
}
}
break;
case WM_NOTIFY:
if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY) {
char str[MAX_PATH];
CMsnProto* proto = (CMsnProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
GetDlgItemTextA(hwndDlg, IDC_DIRECTSERVER, str, _countof(str));
if (mir_strcmp(str, MSN_DEFAULT_LOGIN_SERVER))
proto->setString("DirectServer", str);
else
proto->delSetting("DirectServer");
GetDlgItemTextA(hwndDlg, IDC_GATEWAYSERVER, str, _countof(str));
if (mir_strcmp(str, MSN_DEFAULT_GATEWAY))
proto->setString("GatewayServer", str);
else
proto->delSetting("GatewayServer");
proto->setByte("SlowSend", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SLOWSEND));
if (proto->getByte("SlowSend", FALSE)) {
if (db_get_dw(NULL, "SRMsg", "MessageTimeout", 60000) < 60000 ||
db_get_dw(NULL, "SRMM", "MessageTimeout", 60000) < 60000) {
MessageBox(NULL, TranslateT("MSN Protocol requires message timeout to be not less then 60 sec. Correct the timeout value."),
TranslateT("MSN Protocol"), MB_OK | MB_ICONINFORMATION);
}
}
#ifdef OBSOLETE
unsigned gethst2 = proto->getByte("AutoGetHost", 1);
#endif
unsigned gethst = SendDlgItemMessage(hwndDlg, IDC_HOSTOPT, CB_GETCURSEL, 0, 0);
if (gethst < 2) gethst = !gethst;
proto->setByte("AutoGetHost", (BYTE)gethst);
if (gethst == 0) {
GetDlgItemTextA(hwndDlg, IDC_YOURHOST, str, _countof(str));
proto->setString("YourHost", str);
}
else proto->delSetting("YourHost");
#ifdef OBSOLETE
if (gethst != gethst2)
proto->ForkThread(&CMsnProto::MSNConnDetectThread, NULL);
#endif
proto->LoadOptions();
return TRUE;
}
}
return FALSE;
}