www.pudn.com > VCAMS.rar > AMMain.cpp
// AMMain.cpp : implementation file
//
#include "stdafx.h"
#include "AMStoneTime.h"
#include "AMMain.h"
#include "SendMessage.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAMMain dialog
CAMMain::CAMMain(CWnd* pParent /*=NULL*/)
: CDialog(CAMMain::IDD, pParent),m_bOnLine(false)
{
//{{AFX_DATA_INIT(CAMMain)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_lUserNum = 0;
}
void CAMMain::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAMMain)
DDX_Control(pDX, IDC_ST_TREE, m_ctlTreeList);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAMMain, CDialog)
//{{AFX_MSG_MAP(CAMMain)
ON_NOTIFY(NM_DBLCLK, IDC_ST_TREE, OnDblclkTree)
ON_BN_CLICKED(IDC_BN_OUT, OnBnOut)
ON_WM_CLOSE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CAMMain message handlers
void CAMMain::OnDblclkTree(NMHDR* pNMHDR, LRESULT* pResult)
{
CPoint mousePoint;
long lUserNum;
long lPos;
GetCursorPos( &mousePoint );
CString strUserName,strLoginName;
CTreeCtrl* pTreeCtrl = ( CTreeCtrl* )this->GetDlgItem(IDC_TREE1);
HTREEITEM treeItemUser;
pTreeCtrl->ScreenToClient( &mousePoint );
treeItemUser = pTreeCtrl->HitTest( mousePoint );
strUserName = pTreeCtrl->GetItemText( treeItemUser );
lUserNum = m_arUserName.GetSize();
for(lPos = 0; lPos < lUserNum ;lPos++ )
{
if( m_arUserName.GetAt( lPos ) == strUserName)
break;
}
strLoginName = m_arLoginName.GetAt( lPos );
CSendMessage sendMessageBox;
sendMessageBox.m_IAMSessionPtr = m_IAMSessionPtr;
sendMessageBox.m_strReceiver = strLoginName;
sendMessageBox.DoModal();
*pResult = 0;
}
void CAMMain::OnBnOut()
{
long lReturn;
m_IAMSessionPtr->CloseSession( &lReturn );
m_IAMSessionPtr.Release();
CDialog::OnCancel();
}
void CAMMain::OnClose()
{
long lReturn;
m_IAMSessionPtr->CloseSession( &lReturn );
m_IAMSessionPtr.Release();
CDialog::OnClose();
}