程序是这样的:
基本对话框MFC程序,
OnInitDialog()函数自己写的部分:// TODO: Add extra initialization here
//禁用任务管理器
DWORD dwData=0;
HKEY hkey; RegOpenKey(HKEY_CURRENT_USER,"Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System",&hkey);
RegSetValueEx(hkey,"DisableTaskMgr",0,REG_DWORD,(LPBYTE)&dwData,sizeof(DWORD));
RegCloseKey(hkey);
CStatic *ptr;
ptr=(CStatic*)GetDlgItem(IDC_SECONDS);
for(int i=59; i; --i)
{
CString Seconds;
Seconds.Format("%d",i);
ptr->SetWindowText(Seconds); //显示当前日间于静态文本框
Sleep(1000); //每隔一秒倒计时
CString words;
m_seconds.GetWindowText(words);
if(words=="somewords"&&b_checked)
{
//CDialog::OnCancel(); break;
}
}
if(!i)
{
Blue(); //这里的Blue是自己写的一个CBeautifulDlg的成员函数
}
return TRUE; // return TRUE unless you set the focus to a control
}运行后连对话框都不显示,在任务管理器里能看到程序的进程,是什么原因啊?
基本对话框MFC程序,
OnInitDialog()函数自己写的部分:// TODO: Add extra initialization here
//禁用任务管理器
DWORD dwData=0;
HKEY hkey; RegOpenKey(HKEY_CURRENT_USER,"Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System",&hkey);
RegSetValueEx(hkey,"DisableTaskMgr",0,REG_DWORD,(LPBYTE)&dwData,sizeof(DWORD));
RegCloseKey(hkey);
CStatic *ptr;
ptr=(CStatic*)GetDlgItem(IDC_SECONDS);
for(int i=59; i; --i)
{
CString Seconds;
Seconds.Format("%d",i);
ptr->SetWindowText(Seconds); //显示当前日间于静态文本框
Sleep(1000); //每隔一秒倒计时
CString words;
m_seconds.GetWindowText(words);
if(words=="somewords"&&b_checked)
{
//CDialog::OnCancel(); break;
}
}
if(!i)
{
Blue(); //这里的Blue是自己写的一个CBeautifulDlg的成员函数
}
return TRUE; // return TRUE unless you set the focus to a control
}运行后连对话框都不显示,在任务管理器里能看到程序的进程,是什么原因啊?
{
CString Seconds;
Seconds.Format("%d",i);
ptr->SetWindowText(Seconds); //显示当前日间于静态文本框
Sleep(1000); //每隔一秒倒计时....}你这里沉睡了1秒钟,并循环60次,至少要1分钟后你的对话框才能显示出来吧?
你等上1分钟,看你的对话框能否显示出来
楼主的结贴率超过100%101.43%