我正在尝试运行以下行:
hRet = ShellExecute(HWND_DESKTOP,
L"open",
(*) L"C:\\...\\wmplayer.exe C:\\...\\.mp4",
NULL,
NULL,
SW_SHOW);
但是文件(.mp4)打不开,可能是因为我在一个参数中给出了两个路径。 我还尝试运行以下命令:
(*) L"\"C:\\...\\wmplayer.exe\" \"C:\\...\\.mp4\""
和:
(*) L"C:\\...\\wmplayer.exe\" \"C:\\...\\.mp4"
但是没有用,你能帮忙吗?? 谢谢...!
最佳答案
阅读文档我会说调用应该是
hRet = ShellExecute(HWND_DESKTOP,
L"open",
L"C:\\...\\wmplayer.exe",
L"C:\\...\\.mp4",
NULL,
SW_SHOW);
文档说:
lpParameters [in, optional] Type: LPCTSTR If lpFile specifies an executable file, this parameter is a pointer to a null-terminated string that specifies the parameters to be passed to the application. The format of this string is determined by the verb that is to be invoked. If lpFile specifies a document file, lpParameters should be NULL.
因此您可以直接将 .mp4
文件作为 lpFile
参数传递并保留此 NULL
(但将使用默认播放器)或者您必须将播放器名称作为文件传递,将电影名称作为参数传递。
关于c++ - 在 ShellExecute 函数中运行多个命令 (C++),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20029138/