Dialog程序怎样操作Windows的cmd(命令提示符)? http://download.csdn.net/source/1668710 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://www.codeproject.com/KB/IP/netcfg.aspx 用匿名管道google 搜 VC 匿名管道 BOOL CRarFilesList::RarCreateFileList(CString strXpathFileName,CString &strListFileName,bool isAtePath){ if(isAtePath) { strXpathFileName=GetAtePath(true)+strXpathFileName; }else { strXpathFileName=GetAppPath()+strXpathFileName; } CString strCommandLine; strCommandLine+="cmd.exe /c "+GetAppPath()+"ftpFileTemp\\Rar.exe vt "+strXpathFileName; strListFileName=strXpathFileName.Left(strXpathFileName.GetLength()-4); strListFileName+=".lst"; strCommandLine=strCommandLine+">"+strListFileName; SECURITY_ATTRIBUTES sa; HANDLE hRead,hWrite; sa.nLength = sizeof(SECURITY_ATTRIBUTES); sa.lpSecurityDescriptor = NULL; sa.bInheritHandle = TRUE; if (!CreatePipe(&hRead,&hWrite,&sa,0)) { TRACE("Error On CreatePipe()"); return FALSE; } STARTUPINFO si; PROCESS_INFORMATION pi; si.cb = sizeof(STARTUPINFO); GetStartupInfo(&si); si.hStdError = hWrite; si.hStdOutput = hWrite; si.wShowWindow = SW_HIDE; si.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES; int ifd=0,iFold=0; while(ifd!=-1) { ifd=strListFileName.Find('\\',iFold+1); if(ifd!=-1) { iFold=ifd; } } strListFileName=strListFileName.Right(strListFileName.GetLength()-iFold-1); // if (!CreateProcess(NULL,"cmd.exe /c ping www.huawei.com -t",NULL,NULL,TRUE,NULL,NULL,NULL,&si,&pi)) if (!CreateProcess(NULL,strCommandLine.GetBuffer(strCommandLine.GetLength()),NULL,NULL,TRUE,NULL,NULL,NULL,&si,&pi)) { // TRACE("Error on CreateProcess()"); return FALSE; } CloseHandle(hWrite); char buffer[4096] = {0}; DWORD bytesRead; while (true) { if (ReadFile(hRead,buffer,4095,&bytesRead,NULL) == NULL) break; TRACE("%s\n",CString(buffer)) ; Sleep(1000); } return true;} (没分了,帮下忙!)如何设置Dialog对话框里一个Edit小控件的字体,并且不影响整个对话框的字体。 结构体不能赋值... 请前辈们指点.. 如何刷新位图 Curl,HTTP下载问题? 呵呵 vc 的取整函数是什么啊????????? 100分,关于socks5代理的问题,高手帮帮忙,读rfc1928所产生的疑问! **黑白图像的储存问题** 有关WM_SIZE发问(70分) 有人愿意帮帮我吗?我都快急死了!!! 很菜的小问题 衍生cgridctrl的BUG,有认识戴老师的么。。。 如何在vc中播放mp4文件
google 搜 VC 匿名管道
{
if(isAtePath)
{
strXpathFileName=GetAtePath(true)+strXpathFileName;
}else
{
strXpathFileName=GetAppPath()+strXpathFileName;
}
CString strCommandLine;
strCommandLine+="cmd.exe /c "+GetAppPath()+"ftpFileTemp\\Rar.exe vt "+strXpathFileName;
strListFileName=strXpathFileName.Left(strXpathFileName.GetLength()-4);
strListFileName+=".lst";
strCommandLine=strCommandLine+">"+strListFileName;
SECURITY_ATTRIBUTES sa;
HANDLE hRead,hWrite;
sa.nLength = sizeof(SECURITY_ATTRIBUTES);
sa.lpSecurityDescriptor = NULL;
sa.bInheritHandle = TRUE;
if (!CreatePipe(&hRead,&hWrite,&sa,0)) {
TRACE("Error On CreatePipe()");
return FALSE;
}
STARTUPINFO si;
PROCESS_INFORMATION pi;
si.cb = sizeof(STARTUPINFO);
GetStartupInfo(&si);
si.hStdError = hWrite;
si.hStdOutput = hWrite;
si.wShowWindow = SW_HIDE;
si.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES;
int ifd=0,iFold=0;
while(ifd!=-1)
{
ifd=strListFileName.Find('\\',iFold+1);
if(ifd!=-1)
{
iFold=ifd;
}
}
strListFileName=strListFileName.Right(strListFileName.GetLength()-iFold-1); // if (!CreateProcess(NULL,"cmd.exe /c ping www.huawei.com -t",NULL,NULL,TRUE,NULL,NULL,NULL,&si,&pi))
if (!CreateProcess(NULL,strCommandLine.GetBuffer(strCommandLine.GetLength()),NULL,NULL,TRUE,NULL,NULL,NULL,&si,&pi))
{
// TRACE("Error on CreateProcess()");
return FALSE;
}
CloseHandle(hWrite);
char buffer[4096] = {0};
DWORD bytesRead;
while (true)
{
if (ReadFile(hRead,buffer,4095,&bytesRead,NULL) == NULL)
break;
TRACE("%s\n",CString(buffer)) ;
Sleep(1000);
}
return true;
}