[原][工具][C++]调用adobe reader打开pdf,通过命令行启动pdf

时间:2024-04-15 17:55:45

百度网盘: adobe reader 11

命令行:

AdobeReaderXIPortable.exe D:\XXX.pdf

 通过C++在windows下打开pdf:

    PROCESS_INFORMATION processInfo;
    STARTUPINFO startupInfo;
    ::ZeroMemory(&startupInfo, sizeof(startupInfo));
    startupInfo.cb = sizeof(startupInfo);
    QString fileName = QString::fromLocal8Bit("xxx.pdf");
    fileName = QString::fromLocal8Bit("E:/软件/adobe_reader11/AdobeReaderXIPortable.exe ") + fileName;
    std::string _file = fileName.toLocal8Bit();
    CreateProcess(NULL, (CHAR*)_file.c_str(),
        NULL,  // process security
        NULL,  // thread security
        FALSE, // no inheritance
        0,     // no startup flags
        NULL,  // no special environment
        NULL,  // default startup directory
        &startupInfo,
        &processInfo);