本文整理汇总了C++中PINGLIST::back方法的典型用法代码示例。如果您正苦于以下问题:C++ PINGLIST::back方法的具体用法?C++ PINGLIST::back怎么用?C++ PINGLIST::back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PINGLIST
的用法示例。
在下文中一共展示了PINGLIST::back方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SendDlgItemMessage
// ping hosts list window
static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch ( msg ) {
case WM_INITDIALOG:
TranslateDialogDefault( hwndDlg );
Lock(&data_list_cs, "init options dialog");
temp_list = data_list;
Unlock(&data_list_cs);
for (pinglist_it i = temp_list.begin(); i != temp_list.end(); ++i)
{
int index = SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_INSERTSTRING, (WPARAM)-1, (LPARAM)i->pszLabel);
SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_SETITEMDATA, index, (LPARAM)&(*i));
}
return TRUE;
case WM_COMMAND:
if (HIWORD( wParam ) == LBN_SELCHANGE && LOWORD(wParam) == IDC_LST_DEST)
{
int sel = SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_GETCURSEL, 0, 0);
if(sel != LB_ERR)
{
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_DESTREM), TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_DESTEDIT), TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_DESTUP), (sel > 0));
int count = SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_GETCOUNT, 0, 0);
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_DESTDOWN), (sel < count - 1));
}
}
if ( HIWORD( wParam ) == BN_CLICKED )
{
switch( LOWORD( wParam ))
{
case IDC_BTN_DESTEDIT:
{
int sel = SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_GETCURSEL, 0, 0);
if (sel != LB_ERR)
{
PINGADDRESS *item = (PINGADDRESS *)SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_GETITEMDATA, sel, 0);
PINGADDRESS temp = *item;
if (Edit(hwndDlg, temp))
{
*item = temp;
SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_DELETESTRING, (WPARAM)sel, 0);
SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_INSERTSTRING, (WPARAM)sel, (LPARAM)item->pszLabel);
SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_SETITEMDATA, (WPARAM)sel, (LPARAM)item);
SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_SETCURSEL, (WPARAM)sel, 0);
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_DESTREM), TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_DESTEDIT), TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_DESTUP), sel > 0);
int count = SendDlgItemMessage(hwndDlg, IDC_BTN_DESTDOWN, LB_GETCOUNT, 0, 0);
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_DESTDOWN), (sel < count - 1));
SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
}
}
}
break;
case IDC_BTN_DESTADD:
memset(&add_edit_addr,0,sizeof(add_edit_addr));
add_edit_addr.cbSize = sizeof(add_edit_addr);
add_edit_addr.port = -1;
add_edit_addr.set_status = ID_STATUS_ONLINE;
add_edit_addr.get_status = ID_STATUS_OFFLINE;
add_edit_addr.status = PS_NOTRESPONDING;
add_edit_addr.item_id = 0;
add_edit_addr.index = (int)temp_list.size();
if(DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG3), hwndDlg, DlgProcDestEdit) == IDOK)
{
temp_list.push_back(add_edit_addr);
int index = SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_INSERTSTRING, (WPARAM)-1, (LPARAM)add_edit_addr.pszLabel);
SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_SETCURSEL, (WPARAM)index, 0);
SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_SETITEMDATA, (WPARAM)index, (LPARAM)&(temp_list.back()));
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_DESTREM), TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_DESTEDIT), TRUE);
int sel = (int)temp_list.size() - 1;
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_DESTUP), (sel > 0));
int count = SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_GETCOUNT, 0, 0);
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_DESTDOWN), (sel < count - 1));
SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
}
break;
case IDC_BTN_DESTREM:
{
int sel = SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_GETCURSEL, 0, 0);
if(sel != LB_ERR) {
PINGADDRESS *item = (PINGADDRESS *)SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_GETITEMDATA, sel, 0);
SendDlgItemMessage(hwndDlg, IDC_LST_DEST, LB_DELETESTRING, (WPARAM)sel, 0);
//.........这里部分代码省略.........