示例#1
0
int DlgGuardFlags::GetFlags()
{
	CListBox *lb;
	int new_flags = 0;
	
	lb = (CListBox*)GetDlgItem(IDC_GUARD_FLAGS);
	
	for(int i = 0; i < GuardBitCount(); i++) 
	{
		if(lb->GetSel(i))
			SET_BIT(new_flags, lb->GetItemData(i));
		else
			REMOVE_BIT(new_flags, lb->GetItemData(i));
	}

	return new_flags;
}
示例#2
0
文件: ConnDlg.cpp 项目: trieck/source
void CConnDlg :: OnKillSocket()
{
    CWysApp* pApp = (CWysApp*)AfxGetApp();
    INT iItem;
    CString szTemp;
    SCREENLINE sl;

    // get the current selection
    CWysWnd* pWnd = (CWysWnd*)pApp->m_pMainWnd;
    CListBox* pListBox = (CListBox*)GetDlgItem(IDC_LSTCONN);

    iItem = pListBox->GetCurSel();

    if (iItem == LB_ERR) {
        szTemp.LoadString(IDS_NOSEL);
        this->MessageBox(szTemp, NULL, MB_ICONINFORMATION);
        return;
    }

    // get the socket value
    // for currently selected item
    SOCKET hSocket;
    hSocket = (SOCKET)pListBox->GetItemData(iItem);
    if (hSocket == LB_ERR) {
        szTemp.LoadString(IDS_SOCKERRLST);
        this->MessageBox(szTemp, NULL, MB_ICONINFORMATION);
        return;
    }

    szTemp.LoadString(IDS_KILLSOCK);
    if (this->MessageBox(szTemp, "Kill Connection", MB_ICONQUESTION |
                         MB_YESNO | MB_DEFBUTTON2) == IDYES) {
        CWySock* pSock = (CWySock*)CAsyncSocket::FromHandle(hSocket);
        if (!pSock) {
            szTemp.LoadString(IDS_ERRNOSOCK);
            this->MessageBox(szTemp, NULL, MB_ICONINFORMATION);
            return;
        }

        // add item to screen list
        sl.uColor = COLOR_RED;
        szTemp.LoadString(IDS_SERVKILL);
        sl.szText.Format(szTemp, pSock->IPAddress);
        pWnd->AddListItem(&sl);

        // remove socket from array of connected sockets
        pSock->Close();
        pSock->m_hSocket	= INVALID_SOCKET;
        pSock->State		= FREE;

        //  refresh list
        OnRefresh();
    }
    return;
}
示例#3
0
void CLabelTypeDialog::OnOK()
{
	CListBox* pList;
	if ((pList = (CListBox*)GetDlgItem(IDC_LABEL_LIST)) != NULL)
	{
		int nCurSel = pList->GetCurSel();
		if (nCurSel != -1)
		{
			m_pChosenLabel = (CLabelData*)pList->GetItemData(nCurSel);
		}
	}
	CPmwDialogColor::OnOK();
}
示例#4
0
void CEnvelopeTypeDialog::OnOK()
{
	CListBox* pList;
	if ((pList = (CListBox*)GetDlgItem(IDC_ENVELOPE_LIST)) != NULL)
	{
		int nCurSel = pList->GetCurSel();
		if (nCurSel != -1)
		{
			m_pChosenInfo = (CLabelData*)pList->GetItemData(nCurSel);
		}
	}

	CPmwDialogColor::OnOK();
}
示例#5
0
void CLabelTypeDialog::OnSelchangeLabelList()
{
	CLabelData* pLabelData = NULL;

	CListBox* pList;
	if ((pList = (CListBox*)GetDlgItem(IDC_LABEL_LIST)) != NULL)
	{
		int nCurSel = pList->GetCurSel();
		if (nCurSel != -1)
		{
			pLabelData = (CLabelData*)pList->GetItemData(nCurSel);
		}
	}
	m_pPreview->SetLabel(pLabelData);
}
示例#6
0
void CEnvelopeTypeDialog::OnSelchangeEnvelopeList()
{
	m_pChosenInfo = NULL;

	CListBox* pList;
	if ((pList = (CListBox*)GetDlgItem(IDC_ENVELOPE_LIST)) != NULL)
	{
		int nCurSel = pList->GetCurSel();
		if (nCurSel != -1)
		{
			m_pChosenInfo = (CLabelData*)pList->GetItemData(nCurSel);
		}
	}
	UpdatePreview();
}
示例#7
0
//**************************************************************************
void OPCServerDlg::OnSelchangeServerList()
{
   CWaitCursor wait;
   UpdateData();

   CListBox* pList = (CListBox*)GetDlgItem( IDC_SERVER_LIST );
   int index = pList->GetCurSel();
   OPCServerInfo* pServerInfo = (OPCServerInfo*)pList->GetItemData(index);
   if( pServerInfo && (DWORD)pServerInfo != LB_ERR )
   {
      m_clsid = pServerInfo->m_clsid;
      m_Server = pServerInfo->m_ProgID;
   }

   UpdateData( FALSE );
}
示例#8
0
void CPhotoProjectsTypeDlg::OnSelchangePhotoProjectsList()
{

	CListBox* pList;
	if ((pList = (CListBox*)GetDlgItem(IDC_PHOTOPROJECTS_LIST)) != NULL)
	{
		int nCurSel = pList->GetCurSel();
		if (nCurSel != -1)
		{
			m_pChosenPhotoProject = (CPhotoPrjData*)pList->GetItemData(nCurSel);
		}
	}


	UpdatePreview();
}
示例#9
0
void CPhotoProjectsTypeDlg::OnOK()
{
	CListBox* pList;
	if ((pList = (CListBox*)GetDlgItem(IDC_PHOTOPROJECTS_LIST)) != NULL)
	{
		int nCurSel = pList->GetCurSel();
		if (nCurSel != -1)
		{
			m_pChosenPhotoProject = (CPhotoPrjData*)pList->GetItemData(nCurSel);

			int nType = nCurSel;
			m_PhotoProjectType = (PHOTO_PROJECT_TYPE)nType;
		}
	}
	CPmwDialogColor::OnOK();
}