如何通过编程打开文本文件(不是读取)
如何通过编程打开文本文件,不是读取,而是打开,相当于直接用鼠标双击打开文件,谢谢
调用记事本程序打开文件
WinExec("notepad.exe", C:\\1.txt", SW_SHOW);
//这段代码是固定的 PROCESS_INFORMATION piProcInfoGPS; STARTUPINFO siStartupInfo; SECURITY_ATTRIBUTES saProcess, saThread; ZeroMemory( &siStartupInfo, sizeof(siStartupInfo)); siStartupInfo.cb = sizeof(siStartupInfo); saProcess.nLength = sizeof(saProcess); saProcess.lpSecurityDescriptor = NULL; saProcess.bInheritHandle = true; saThread.nLength = sizeof(saThread); saThread.lpSecurityDescriptor = NULL; saThread.bInheritHandle = true; //如果用这句代码,则命令行参数只有一个,就是"-T" ::CreateProcess(".\\BIN\\SVD.exe","-T", &saProcess,&saThread,false, CREATE_DEFAULT_ERROR_MODE,NULL,NULL,&siStartupInfo,&piProcInfoGPS); //如果用这句代码,则命令行参数有两个,第一个是EXE的路径和名称,第二个是"-T" ::CreateProcess(NULL,".\\BIN\\SVD.exe -T", &saProcess,&saThread,false, CREATE_DEFAULT_ERROR_MODE,NULL,NULL,&siStartupInfo,&piProcInfoGPS);
WinExec( "notepad.exe", SW_NORMAL);
ShellExecute( NULL, NULL, _T("1.txt"), NULL, _T("c:\\temp"),SW_SHOWMAXMIZED);