您的位置:首页 > 运维架构

打开进程,等操作 openProcess

2012-05-18 15:54 281 查看
E:\EClient\复件打包配置2\setup (工程:)

BOOL CSetupDlg::OpenProcess(CString lpCmd , DWORD dwWaitTime )

{
STARTUPINFO stinfo;
PROCESS_INFORMATION procinfo;
memset(&stinfo,0,sizeof(stinfo));
stinfo.cb = sizeof(stinfo);
memset(&procinfo,0,sizeof(PROCESS_INFORMATION));

stinfo.dwFlags = STARTF_USESHOWWINDOW;  
stinfo.wShowWindow = SW_HIDE;

CreateProcess( NULL , (LPWSTR)(LPCTSTR)lpCmd, NULL, NULL, FALSE,
NORMAL_PRIORITY_CLASS, NULL, NULL, &stinfo, &procinfo); 

//MessageBox(_T("hello,openprocess"));
if (NULL == procinfo.hProcess)
return FALSE;

if (WaitForSingleObject(procinfo.hProcess , dwWaitTime) == WAIT_TIMEOUT)
return FALSE;
return TRUE;
}

//删除文件

void  CSetupDlg::DeleteFiles()

{
OnTestlistctrlBtn();
if(0 == nAmountFiles)
{
MessageBox(_T("没有选择要删除的文件"));
return ;
}
CFileFind FileFind;
CString  m_strde;
BOOL bFound;
for(int i = 0; i < nAmountFiles; i++)
{
m_strde = strDest[i];
bFound = FileFind.FindFile(m_strde,   0);

if(bFound) 
{
OpenProcess("cmd.exe /c del \"" + m_strde + "\"" ); 
//MessageBox(m_strde);
}
}

// OpenProcess("cmd.exe /c del \"" + FileFind.GetFilePath() + "\"" , 500); 

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  null class