我用
WinExec("Notepad.exe report.txt", SW_SHOW);
可以启动记事本来显示report.txt文件但是用
WinExec("wordpad.exe report.wri", SW_SHOW);
却没有反应!
用
WinExec("word.exe report.wri", SW_SHOW);
也没有反应!我错在哪里?
因为我的程序需要在不同的环境下使用,所以启动外部程序就没有包含路径了,是这个地方的问题?
WinExec("Notepad.exe report.txt", SW_SHOW);
可以启动记事本来显示report.txt文件但是用
WinExec("wordpad.exe report.wri", SW_SHOW);
却没有反应!
用
WinExec("word.exe report.wri", SW_SHOW);
也没有反应!我错在哪里?
因为我的程序需要在不同的环境下使用,所以启动外部程序就没有包含路径了,是这个地方的问题?
因为我的程序需要在不同的环境下使用,所以启动外部程序就没有包含路径了,是这个地方的问题?是这个地方的问题
MSDN的解释为:
If the name of the executable file in the lpCmdLine parameter does not contain a directory path, the system searches for the executable file in this sequence:
1、The directory from which the application loaded.
The current directory.
2、The Windows system directory. TheGetSystemDirectory function retrieves the path of this directory.
3、The Windows directory. TheGetWindowsDirectory function retrieves the path of this directory.
4、The directories listed in the PATH environment variable.
Win2000中都可以直接
WinExec("write.exe report.wri",SW_SHOW);
WinExec("wordpad.exe report.wri",SW_SHOW);
来运行