/* HandleFileDragDrop是NSIS拖动获取目录和文件路径的插件 MakeDropWindow:第一个参数是接受拖动的目标控件.第二个参数是回调函数可以自定义操作. */ !addplugindir "." OutFile "handleFileDragDrop.exe" ShowInstDetails show RequestExecutionLevel user CompletedText "Drop files on me..." SpaceTexts none InstallDir $temp !include "WinMessages.nsh" page directory "" dirShow page InstFiles Function pythonschool FindWindow $1 "#32770" "" $HWNDPARENT GetDlgItem $2 $1 0x3FB SendMessage $2 ${WM_SETTEXT} 0 "STR:$0" FunctionEnd Function dirShow FindWindow $1 "#32770" "" $HWNDPARENT GetDlgItem $0 $1 0x3E9 EnableWindow $0 0 GetDlgItem $0 $1 0x3FB #GetFunctionAddress $3 pythonschool HandleFileDragDrop::MakeDropWindow $0 '' ;blank string means no callback, auto sets text of the window FunctionEnd Function InstPageDrop DetailPrint Drop:$0 StrCpy $0 "" ;set to blank if you want the next file (if any) FunctionEnd Section GetFunctionAddress $0 InstPageDrop HandleFileDragDrop::MakeDropWindow $hwndparent $0 ;Error code is in $0, 0=success SectionEnd Function .OnGuiEnd HandleFileDragDrop::NOP FunctionEnd