简体   繁体   English

NSIS-Windows 8 PDF Viewer,即glcnd.exe-如何从nsis启动以显示自述文件

[英]NSIS - Windows 8 PDF Viewer i.e. glcnd.exe - how to launch from nsis to show Readme

Hi I am trying to launch the dedicated Windows 8 PDF viewer to show the readme file in windows 8. 嗨,我正在尝试启动专用的Windows 8 PDF查看器以在Windows 8中显示自述文件。

I want to use ExecShell or equivalent method. 我想使用ExecShell或等效方法。 There is no documemtation on parameterizing the input to the exe for the Windows 8 viewer. 对于Windows 8查看器的exe输入参数,没有文档说明。

Anyone any suggestions? 有任何建议吗?

I don't think it's a good idea to force a specific app but here you go: 我认为强制使用特定的应用程序不是一个好主意,但是您可以执行以下操作:

!include LogicLib.nsh
!define pdffile "$desktop\test.pdf" 
!define ReaderAppId "Microsoft.Reader_8wekyb3d8bbwe!Microsoft.Reader" ; This is probably unique per machine/user
!define CLSCTX_LOCAL_SERVER 0x4
!define IID_IShellItem {43826d1e-e718-42ee-bc55-a1e261c37bfe}
!define IID_IShellItemArray {B63EA76D-1F85-456F-A19C-48159EFA858B}
!define CLSID_ApplicationActivationManager {45BA127D-10A8-46EA-8AB7-56EA9078943C}
!define IApplicationActivationManager {2e941141-7f97-4756-ba1d-9decde894a3d}

System::Call 'OLE32::CoCreateInstance(g "${CLSID_ApplicationActivationManager}",i0,i${CLSCTX_LOCAL_SERVER},g "${IApplicationActivationManager}",*i.r1)i.r0'
DetailPrint HR=$0,ptr=$1
${If} $1 <> 0
    System::Call 'OLE32::CoAllowSetForegroundWindow(i$1,i0)'
    System::Call 'SHELL32::SHCreateItemFromParsingName(w "${pdffile}",i0,g "${IID_IShellItem}",*i.r2)'
    ${If} $2 <> 0
        System::Call 'SHELL32::SHCreateShellItemArrayFromShellItem(i$2,g "${IID_IShellItemArray}",*i.r3)'
        System::Call `$2->2()` ; Release
    ${If} $3 <> 0
    System::Call `$1->4(w "${ReaderAppId}",i$3,i0,*i.r4)i.r0` ; ActivateForFile
    DetailPrint HR=$0,PID=$4
    System::Call `$1->2()` ; Release
    System::Call `$3->2()` ; Release
    ${EndIf}
    ${EndIf}
${EndIf}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM