如何使用 NSIS 从许可协议安装程序屏幕单击"print"时显示打印 dilaog 以选择打印选项



如何显示打印对话框以选择单击"打印"时打印的选项。使用NSIS的许可协议安装程序屏幕。

单击"打印"时,我想显示下面的屏幕。从许可协议屏幕中。

如果我使用以下命令,则直接打印页面而不弹出打印对话框。

没有内置支持,但是您可以使用系统插件显示此常见的对话框:

!include LogicLib.nsh
!define /IfNDef PD_HIDEPRINTTOFILE 0x00100000
!define /IfNDef PD_NOSELECTION 0x00000004
!define /IFNDef PD_USEDEVMODECOPIESANDCOLLATE 0x00040000 ; Just one copy

Function ShowPrintDlg
System::Call '*(p0,p$hwndparent,p0,p0,p,i${PD_HIDEPRINTTOFILE}|${PD_NOSELECTION}|${PD_USEDEVMODECOPIESANDCOLLATE},&i2,&i2,&i2,&i2,&i2,p,p,p,p,p0,p0,p0,p0,&l.r0)p.r1'
System::Call '*$1(ir0)'
System::Call 'COMDLG32::PrintDlg(pr1)i.r0'
${If} $0 <> 0
    System::Call '*$1(p,p,p.r3,p.r4,t""r2)'
    System::Free $1
    System::Call 'KERNEL32::GlobalFree(pr3)'
    System::Call 'KERNEL32::GlobalLock(pr4)p.r1'
    ${If} $1 P<> 0
        System::Call '*$1(&i2,&i2.r2,&i2,&i2)'
        System::Call '*$1(&i$2,&t999.r2)'
        System::Call 'KERNEL32::GlobalUnlock(pr1)'
        System::Call 'KERNEL32::GlobalFree(pr4)'
    ${EndIf}
    MessageBox mb_ok 'User wants to print to "$2"'
${Else}
    System::Free $1
${EndIf}
FunctionEnd
Page InstFiles
Section
Call ShowPrintDlg
SectionEnd

最新更新