VC中创建了一个新的进程,为什么程序还是顺序执行呢
boolm_end=false;HWNDhWnd;UINTThreadProc(LPVOIDpParam)//{m_progres.Create(WS_VISIBLE|W...
bool m_end = false;
HWND hWnd;
UINT ThreadProc(LPVOID pParam)//
{
m_progres.Create(WS_VISIBLE|WS_CHILD|PBS_SMOOTH, CRect(0,600,980,620),AfxGetMainWnd(),1020);
m_progres.SendMessage(PBM_SETBARCOLOR, 0, RGB( 0, 0,255));
m_progres.SendMessage(PBM_SETBKCOLOR, 0, RGB(0, 0, 100));
m_progres.SetRange(1,100);
for (int i=1;i<100;i++)
{
m_progres.SetPos(i);
Sleep(5);
}
return 0;
}
void CSCSampleDlg::OnXncef()
{
// TODO: Add your control notification handler code her
CWinThread* pThread;
hWnd = GetSafeHwnd();
pThread = AfxBeginThread(ThreadProc,hWnd);
pThread->m_bAutoDelete = false;
…………………………省略……………………
m_end = true;
WaitForSingleObject(pThread->m_hThread,INFINITE);
delete pThread;
}
11 展开
HWND hWnd;
UINT ThreadProc(LPVOID pParam)//
{
m_progres.Create(WS_VISIBLE|WS_CHILD|PBS_SMOOTH, CRect(0,600,980,620),AfxGetMainWnd(),1020);
m_progres.SendMessage(PBM_SETBARCOLOR, 0, RGB( 0, 0,255));
m_progres.SendMessage(PBM_SETBKCOLOR, 0, RGB(0, 0, 100));
m_progres.SetRange(1,100);
for (int i=1;i<100;i++)
{
m_progres.SetPos(i);
Sleep(5);
}
return 0;
}
void CSCSampleDlg::OnXncef()
{
// TODO: Add your control notification handler code her
CWinThread* pThread;
hWnd = GetSafeHwnd();
pThread = AfxBeginThread(ThreadProc,hWnd);
pThread->m_bAutoDelete = false;
…………………………省略……………………
m_end = true;
WaitForSingleObject(pThread->m_hThread,INFINITE);
delete pThread;
}
11 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询