// SelMsgContent.cpp : implementation file
//

#include "stdafx.h"
#include "ylgl.h"
#include "SelMsgContent.h"
#include "SelMsgContent2.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// SelMsgContent dialog


SelMsgContent::SelMsgContent(CWnd* pParent /*=NULL*/)
	: CDialog(SelMsgContent::IDD, pParent)
{
	//{{AFX_DATA_INIT(SelMsgContent)
	m_content = _T("");
	//}}AFX_DATA_INIT
}


void SelMsgContent::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(SelMsgContent)
	DDX_Control(pDX, IDC_LIST1, m_List1);
	DDX_Text(pDX, IDC_EDIT1, m_content);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(SelMsgContent, CDialog)
	//{{AFX_MSG_MAP(SelMsgContent)
	ON_LBN_SELCHANGE(IDC_LIST1, OnSelchangeList1)
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// SelMsgContent message handlers

BOOL SelMsgContent::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here

	g_sendhead.bsql=0;
	g_sendhead.code[0]=134;
	g_sendhead.tabcount=1;
	g_pMainWnd->ProcessChatMessageRequest2(1);if(g_bSendOK==0)return false;
	DataToArray(&m_List1array);

	for(int i=0; i<m_List1array.GetSize (); i++)
	{
		m_List1.AddString (m_List1array.ElementAt (i).ElementAt (0));
	}
	CenterWindow();
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void SelMsgContent::OnOK() 
{
	// TODO: Add extra validation here
	UpdateData();
	CDialog::OnOK();
}

void SelMsgContent::OnSelchangeList1() 
{
	// TODO: Add your control notification handler code here
 

	int pos=m_List1.GetCurSel ();
	if(pos==-1)return;
	CString companyname=g_cominfoarray.ElementAt (0).ElementAt (10);
	CString phone=g_cominfoarray.ElementAt (0).ElementAt (11);
	m_content=m_List1array.ElementAt (pos).ElementAt (1);
	m_content.Replace ("[��˾����]", companyname);
	m_content.Replace ("[�绰]", phone);
	UpdateData(false);

}

void SelMsgContent::OnButton1() 
{
	// TODO: Add your control notification handler code here
	SelMsgContent2 dlg;
    dlg.DoModal ();
 
	g_sendhead.bsql=0;
	g_sendhead.code[0]=134;
	g_sendhead.tabcount=1;
	g_pMainWnd->ProcessChatMessageRequest2(1);if(g_bSendOK==0)return;
	DataToArray(&m_List1array);
	m_List1.ResetContent ();
	for(int i=0; i<m_List1array.GetSize (); i++)
	{
		m_List1.AddString (m_List1array.ElementAt (i).ElementAt (0));
	}

 
}