本文整理汇总了C++中CJabberProto::WindowSubscribe方法的典型用法代码示例。如果您正苦于以下问题:C++ CJabberProto::WindowSubscribe方法的具体用法?C++ CJabberProto::WindowSubscribe怎么用?C++ CJabberProto::WindowSubscribe使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CJabberProto
的用法示例。
在下文中一共展示了CJabberProto::WindowSubscribe方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PersonalDlgProc
static INT_PTR CALLBACK PersonalDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
const unsigned long iPageId = 0;
CJabberProto *ppro = (CJabberProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (msg) {
case WM_INITDIALOG:
if (lParam) {
ppro = (CJabberProto*)lParam;
TranslateDialogDefault(hwndDlg);
SendDlgItemMessage(hwndDlg, IDC_GENDER, CB_ADDSTRING, 0, (LPARAM)TranslateT("Male"));
SendDlgItemMessage(hwndDlg, IDC_GENDER, CB_ADDSTRING, 0, (LPARAM)TranslateT("Female"));
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
SendMessage(hwndDlg, WM_JABBER_REFRESH_VCARD, 0, 0);
ppro->WindowSubscribe(hwndDlg);
}
break;
case WM_JABBER_REFRESH_VCARD:
SetDialogField(ppro, hwndDlg, IDC_FULLNAME, "FullName");
SetDialogField(ppro, hwndDlg, IDC_NICKNAME, "Nick");
SetDialogField(ppro, hwndDlg, IDC_FIRSTNAME, "FirstName");
SetDialogField(ppro, hwndDlg, IDC_MIDDLE, "MiddleName");
SetDialogField(ppro, hwndDlg, IDC_LASTNAME, "LastName");
SetDialogField(ppro, hwndDlg, IDC_BIRTH, "BirthDate");
SetDialogField(ppro, hwndDlg, IDC_GENDER, "GenderString", true);
SetDialogField(ppro, hwndDlg, IDC_OCCUPATION, "Role");
SetDialogField(ppro, hwndDlg, IDC_HOMEPAGE, "Homepage");
break;
case WM_COMMAND:
if (((HWND)lParam == GetFocus() && HIWORD(wParam) == EN_CHANGE) ||
((HWND)lParam == GetDlgItem(hwndDlg, IDC_GENDER) && (HIWORD(wParam) == CBN_EDITCHANGE || HIWORD(wParam) == CBN_SELCHANGE))) {
ppro->m_vCardUpdates |= (1UL << iPageId);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
break;
case WM_NOTIFY:
if (((LPNMHDR)lParam)->idFrom == 0) {
switch (((LPNMHDR)lParam)->code) {
case PSN_PARAMCHANGED:
SendMessage(hwndDlg, WM_INITDIALOG, 0, ((PSHNOTIFY*)lParam)->lParam);
break;
case PSN_APPLY:
ppro->m_vCardUpdates &= ~(1UL << iPageId);
ppro->SaveVcardToDB(hwndDlg, iPageId);
if (!ppro->m_vCardUpdates)
ppro->SetServerVcard(ppro->m_bPhotoChanged, ppro->m_szPhotoFileName);
break;
}
}
break;
case WM_DESTROY:
ppro->WindowUnsubscribe(hwndDlg);
break;
}
return FALSE;
}
示例2: NoteDlgProc
static INT_PTR CALLBACK NoteDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
const unsigned long iPageId = 4;
CJabberProto *ppro = (CJabberProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (msg) {
case WM_INITDIALOG:
if (!lParam) break; // Launched from userinfo
ppro = (CJabberProto*)lParam;
TranslateDialogDefault(hwndDlg);
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
SendMessage(hwndDlg, WM_JABBER_REFRESH_VCARD, 0, 0);
ppro->WindowSubscribe(hwndDlg);
break;
case WM_JABBER_REFRESH_VCARD:
SetDialogField(ppro, hwndDlg, IDC_DESC, "About");
break;
case WM_COMMAND:
if ((HWND)lParam == GetFocus() && HIWORD(wParam) == EN_CHANGE) {
ppro->m_vCardUpdates |= (1UL << iPageId);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
break;
case WM_NOTIFY:
if (((LPNMHDR)lParam)->idFrom == 0) {
switch (((LPNMHDR)lParam)->code) {
case PSN_PARAMCHANGED:
SendMessage(hwndDlg, WM_INITDIALOG, 0, ((PSHNOTIFY*)lParam)->lParam);
break;
case PSN_APPLY:
ppro->m_vCardUpdates &= ~(1UL<<iPageId);
ppro->SaveVcardToDB(hwndDlg, iPageId);
if (!ppro->m_vCardUpdates)
ppro->SetServerVcard(ppro->m_bPhotoChanged, ppro->m_szPhotoFileName);
break;
}
}
break;
case WM_DESTROY:
ppro->WindowUnsubscribe(hwndDlg);
break;
}
return FALSE;
}
示例3: email
static INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM, LPARAM lParam)
{
const unsigned long iPageId = 5;
CJabberProto *ppro = (CJabberProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (msg) {
case WM_INITDIALOG:
if (!lParam) break; // Launched from userinfo
ppro = (CJabberProto*)lParam;
{
LVCOLUMN lvc;
RECT rc;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
TranslateDialogDefault(hwndDlg);
GetClientRect(GetDlgItem(hwndDlg, IDC_EMAILS), &rc);
rc.right -= GetSystemMetrics(SM_CXVSCROLL);
lvc.mask = LVCF_WIDTH;
lvc.cx = 30;
ListView_InsertColumn(GetDlgItem(hwndDlg, IDC_EMAILS), 0, &lvc);
ListView_InsertColumn(GetDlgItem(hwndDlg, IDC_PHONES), 0, &lvc);
lvc.cx = rc.right - 30 - 40;
ListView_InsertColumn(GetDlgItem(hwndDlg, IDC_EMAILS), 1, &lvc);
ListView_InsertColumn(GetDlgItem(hwndDlg, IDC_PHONES), 1, &lvc);
lvc.cx = 20;
ListView_InsertColumn(GetDlgItem(hwndDlg, IDC_EMAILS), 2, &lvc);
ListView_InsertColumn(GetDlgItem(hwndDlg, IDC_EMAILS), 3, &lvc);
ListView_InsertColumn(GetDlgItem(hwndDlg, IDC_PHONES), 2, &lvc);
ListView_InsertColumn(GetDlgItem(hwndDlg, IDC_PHONES), 3, &lvc);
SendMessage(hwndDlg, M_REMAKELISTS, 0, 0);
ppro->WindowSubscribe(hwndDlg);
}
break;
case M_REMAKELISTS:
{
int i;
char idstr[33];
TCHAR number[20];
//e-mails
ListView_DeleteAllItems(GetDlgItem(hwndDlg, IDC_EMAILS));
LVITEM lvi;
lvi.mask = LVIF_TEXT | LVIF_PARAM;
lvi.iSubItem = 0;
lvi.iItem = 0;
for (i=0;;i++) {
mir_snprintf(idstr, "e-mail%d", i);
ptrT email( ppro->getTStringA(idstr));
if (email == NULL) break;
mir_sntprintf(number, _T("%d"), i+1);
lvi.pszText = number;
lvi.lParam = (LPARAM)i;
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_EMAILS), &lvi);
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_EMAILS), lvi.iItem, 1, email);
lvi.iItem++;
}
lvi.mask = LVIF_PARAM;
lvi.lParam = -1;
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_EMAILS), &lvi);
//phones
ListView_DeleteAllItems(GetDlgItem(hwndDlg, IDC_PHONES));
lvi.mask = LVIF_TEXT | LVIF_PARAM;
lvi.iSubItem = 0;
lvi.iItem = 0;
for (i=0;;i++) {
mir_snprintf(idstr, "Phone%d", i);
ptrT phone( ppro->getTStringA(idstr));
if (phone == NULL) break;
mir_sntprintf(number, _T("%d"), i+1);
lvi.pszText = number;
lvi.lParam = (LPARAM)i;
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi);
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 1, phone);
lvi.iItem++;
}
lvi.mask = LVIF_PARAM;
lvi.lParam = -1;
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi);
}
break;
case WM_NOTIFY:
switch (((LPNMHDR)lParam)->idFrom) {
case 0:
switch (((LPNMHDR)lParam)->code) {
case PSN_PARAMCHANGED:
SendMessage(hwndDlg, WM_INITDIALOG, 0, ((PSHNOTIFY*)lParam)->lParam);
break;
case PSN_APPLY:
ppro->m_vCardUpdates &= ~(1UL << iPageId);
ppro->SaveVcardToDB(hwndDlg, iPageId);
if (!ppro->m_vCardUpdates)
ppro->SetServerVcard(ppro->m_bPhotoChanged, ppro->m_szPhotoFileName);
//.........这里部分代码省略.........
示例4: WorkDlgProc
static INT_PTR CALLBACK WorkDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
const unsigned long iPageId = 2;
CJabberProto *ppro = (CJabberProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (msg) {
case WM_INITDIALOG:
if (lParam) { // proto info is available
ppro = (CJabberProto*)lParam;
TranslateDialogDefault(hwndDlg);
for (int i = 0; i < g_cbCountries; i++) {
if (g_countries[i].id != 0xFFFF && g_countries[i].id != 0) {
TCHAR *country = mir_a2t(g_countries[i].szName);
SendDlgItemMessage(hwndDlg, IDC_COUNTRY, CB_ADDSTRING, 0, (LPARAM)TranslateTS(country));
mir_free(country);
}
}
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
SendMessage(hwndDlg, WM_JABBER_REFRESH_VCARD, 0, 0);
ppro->WindowSubscribe(hwndDlg);
}
break;
case WM_JABBER_REFRESH_VCARD:
SetDialogField(ppro, hwndDlg, IDC_COMPANY, "Company");
SetDialogField(ppro, hwndDlg, IDC_DEPARTMENT, "CompanyDepartment");
SetDialogField(ppro, hwndDlg, IDC_TITLE, "CompanyPosition");
SetDialogField(ppro, hwndDlg, IDC_ADDRESS1, "CompanyStreet");
SetDialogField(ppro, hwndDlg, IDC_ADDRESS2, "CompanyStreet2");
SetDialogField(ppro, hwndDlg, IDC_CITY, "CompanyCity");
SetDialogField(ppro, hwndDlg, IDC_STATE, "CompanyState");
SetDialogField(ppro, hwndDlg, IDC_ZIP, "CompanyZIP");
SetDialogField(ppro, hwndDlg, IDC_COUNTRY, "CompanyCountry", true);
break;
case WM_COMMAND:
if (((HWND)lParam == GetFocus() && HIWORD(wParam) == EN_CHANGE) ||
((HWND)lParam == GetDlgItem(hwndDlg, IDC_COUNTRY) && (HIWORD(wParam) == CBN_EDITCHANGE || HIWORD(wParam) == CBN_SELCHANGE)))
{
ppro->m_vCardUpdates |= (1UL << iPageId);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
break;
case WM_NOTIFY:
if (((LPNMHDR)lParam)->idFrom == 0) {
switch (((LPNMHDR)lParam)->code) {
case PSN_PARAMCHANGED:
SendMessage(hwndDlg, WM_INITDIALOG, 0, ((PSHNOTIFY*)lParam)->lParam);
break;
case PSN_APPLY:
ppro->m_vCardUpdates &= ~(1UL << iPageId);
ppro->SaveVcardToDB(hwndDlg, iPageId);
if (!ppro->m_vCardUpdates)
ppro->SetServerVcard(ppro->m_bPhotoChanged, ppro->m_szPhotoFileName);
break;
}
}
break;
case WM_DESTROY:
ppro->WindowUnsubscribe(hwndDlg);
break;
}
return FALSE;
}