TSFD是NSIS增强FileDialog打开文件窗口的插件

/*
TSFD是NSIS增强FileDialog打开文件窗口的插件
TSFD可以指定要打开的文件的类型,通过open/save控制打开文件还是保存文件对话框.
*/
!AddPluginDir "."
!include "MUI2.nsh"
!include nsDialogs.nsh
!include LogicLib.nsh
!include winmessages.nsh
Var INST_SDAT_LOC1
Var INST_SDAT_BTN1
Name "test"
OutFile "nsDialogFileBrowse.exe"
Page custom SettingsPage
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
Function SettingsPage
nsDialogs::Create /NOUNLOAD 1018
Pop $0
;; Only looking inside a specific folder
${NSD_CreateBrowseButton} 410 130 25 12u "..."
Pop $INST_SDAT_BTN1
nsDialogs::SetUserData /NOUNLOAD $INST_SDAT_BTN1 FileRequest # remember field id
GetFunctionAddress $0 FolderBrowseButton
nsDialogs::OnClick /NOUNLOAD $INST_SDAT_BTN1 $0
${NSD_CreateFileRequest} 110 130 300 12u ""
Pop $INST_SDAT_LOC1
nsDialogs::Show
FunctionEnd
Function FolderBrowseButton
StrCpy $2 "C:WindowsSystem32"
tSFD::SelectFileDialog /NOUNLOAD save $2 "*.exe|*.exe"
Pop $2
${If} $2 != ""
SendMessage $INST_SDAT_LOC1 ${WM_SETTEXT} 0 STR:$2
${EndIf}
FunctionEnd
Section
SectionEnd
THE END
喜欢就支持一下吧
点赞14 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容