MFC 打开文件位置和 select(突出显示)文件

MFC Open file location and select (highlight) the file

我正在使用此代码

STARTUPINFO si;
    PROCESS_INFORMATION pi;
    ZeroMemory(&si, sizeof(si));
    si.cb = sizeof(si);
    ZeroMemory(&pi, sizeof(pi));
    CString commandLine = _T("explorer.exe ") + CPathName(destination).DirectoryPath();
    CreateProcess(NULL, commandLine.GetBuffer(), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);

打开导出文件的位置。有没有一种方法可以选择文件,这样我就不必再去找它了?

你的解决方案太复杂,你可以直接使用

ShellExecute

可以在此处找到许多其他解决方案:

Programmatically selecting file in explorer