一个显示问题
在我创建线程函数后声明为static函数 然后用CThreadSystemDlg来获得对话框的指针来引用公有变量
但是我不能用来更新CStatic的显示内容 下面是代码
第一个是创建线程的按钮
void CThreadSystemDlg::OnCreatthread1button()
{
m_threadedit="开始生产!生产中....";
UpdateData(false);
Sleep(1000);
// TODO: Add your control notification handler code here
m_threadpoogress1.SetStep(10);
m_threadpoogress1.SetRange(0,100);
CWinThread *pThread=AfxBeginThread(ThreadFunc,&threadA);
for(int i=0;i<10;i++)
{
m_threadpoogress1.StepIt();
Sleep(500);
}
}
这个是线程函数 我不能在里面更新编辑框的内容
UINT CThreadSystemDlg::ThreadFunc(LPVOID pParam)
{
struct mythread * pThread=(struct mythread *)pParam;
CThreadSystemDlg *ps=(CThreadSystemDlg*)AfxGetApp()->GetMainWnd();
while(buffer>0)
{
for(int i=0;i<10;i++)
{
Sleep(500);
ps->m_threadpoogress1.StepIt();
}
ps->m_threadedit=pThread->p;
// pUpdata->UpdateData(false);
buffer--;
}
return (0);
}
请高手指教!!