全局函数退出问题
void CTaskBarDlg::UpdateChannel(CDatabase *pdb){
int size=m_comm.GetSize();
while(size--)
{
delete m_comm.GetAt(size);
}
m_comm.RemoveAll();
CChannelSet comset(pdb);
CChannelSingle *pchannel;
comset.m_strSort = "ID";
if (comset.Open())
{
while (!comset.IsEOF())
{
CHANNEL channel;
memset(&channel,0,sizeof(CHANNEL));
strcpy(channel.m_name,comset.m_name);
channel.m_ID = comset.m_ID;
channel.m_comm = comset.m_ComPort;
channel.m_baud = comset.m_Baud;
channel.m_stipulations_ID = comset.m_Protocol;
CString bbmm;//=commset.m_name;
bbmm.Format("%02d:",comset.m_ID);
bbmm+=comset.m_name;
m_pdatagram->m_ComboxChannel.AddString(bbmm);
m_pdatagram->m_ComboxChannel.SetCurSel(0);
pchannel = new CChannelSingle(&channel,this);
pchannel->InitPort();
m_comm.Add(pchannel);
comset.MoveNext();
}
comset.Close();
}
}//请问此函数中NEW的pchannel指针该如何释放,在哪释放??
BOOL CChannelSingle::InitPort()
{
m_pThread = AfxBeginThread(CommProc,this,THREAD_PRIORITY_NORMAL,0,
CREATE_SUSPENDED,NULL) ;
}
UINT CommProc(LPVOID pParam)
{
}//请教高手程序退出时此进程该如何退出??
目前由于没有关闭此线程程序退出时老是报错