15,471
社区成员
发帖
与我相关
我的任务
分享
BOOL CWnd::DestroyWindow()
{
if (m_hWnd == NULL)
return FALSE;
CHandleMap* pMap = afxMapHWND();
ASSERT(pMap != NULL);
CWnd* pWnd = (CWnd*)pMap->LookupPermanent(m_hWnd);
#ifdef _DEBUG
HWND hWndOrig = m_hWnd;
#endif
#ifdef _AFX_NO_OCC_SUPPORT
BOOL bResult = ::DestroyWindow(m_hWnd);
#else //_AFX_NO_OCC_SUPPORT
BOOL bResult;
if (m_pCtrlSite == NULL)
bResult = ::DestroyWindow(m_hWnd);
else
bResult = m_pCtrlSite->DestroyControl();
#endif //_AFX_NO_OCC_SUPPORT
// Note that 'this' may have been deleted at this point,
// (but only if pWnd != NULL)
if (pWnd != NULL)
{
// Should have been detached by OnNcDestroy
#ifdef _DEBUG
ASSERT(pMap->LookupPermanent(hWndOrig) == NULL); //这个断言
#endif
}
else
{
#ifdef _DEBUG
ASSERT(m_hWnd == hWndOrig);
#endif
// Detach after DestroyWindow called just in case
Detach();
}
return bResult;
}
UINT CMulThreadDlg::WriteThread(LPVOID pParam)
{
CMulThreadDlg* pDlg=(CMulThreadDlg*)pParam;
PressD pt;
CStdioFile file1;
char str[20];
while(pDlg->flag)
{
file1.Open("c:\\1.txt",CFile::modeCreate|CFile::modeReadWrite|CFile::modeNoTruncate);
file1.SeekToEnd();
while(!pDlg->Pq.empty())
{
pt=pDlg->Pq.front();pDlg->Pq.pop();
for(int i=0;i <10;i++)
{
sprintf(str,"%lf",pt.GetiD(i));
str[19]='\0';
file1.WriteString((LPCTSTR)str); //只要有写入或读的IO操作就会出错。。
file1.WriteString(",");
}
file1.WriteString("\n");
//file1.Close();//这行代码需要提到循环外面
}
file1.Close(); //换位置
Sleep(1000);
}
return 0;
}