HandleFileDragDrop plug-in: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
(v0.2)
(Add vista+ workaround)
Line 39: Line 39:
HandleFileDragDrop::Register $1 $0
HandleFileDragDrop::Register $1 $0
SectionEnd
SectionEnd
</highlight-nsis>
== Remarks ==
In Windows Vista and later UIPI (an UI component of UAC) blocks drag & drop from low integrity processes (like Explorer) to high integrity processes (like the installer if set to require elevation). To work this around, add the following code:
<highlight-nsis>
System::Call 'user32::ChangeWindowMessageFilter(i563, i1)'
System::Call 'user32::ChangeWindowMessageFilter(i74, i1)'
System::Call 'user32::ChangeWindowMessageFilter(i73, i1)'
</highlight-nsis>
</highlight-nsis>


== Credits ==
== Credits ==
Written by Anders (For fun and profit?)
Written by Anders (For fun and profit?)
Vista+ workaround by Anonymous, with the help of https://stackoverflow.com/a/14091973


[[Category:Plugins]]
[[Category:Plugins]]

Revision as of 10:59, 10 February 2020

Author: Anders (talk, contrib)


Links

HandleFileDragDrop.zip (4 KB)

Description

Version: 0.2 - 20181123
Supported on: Win95+/NT4+ (Only tested on XP, should work on any platform)

This plugin will respond to files dropped on the window you specify, it can call a nsis function for each file/folder dropped on the window, or just set the window's text (Useful for file/folder inputs)

Example

OutFile Test.exe
ShowInstDetails show
RequestExecutionLevel user
CompletedText "Drop files on me..."
DirText "You can drop a folder on the text field!"
SpaceTexts none
InstallDir $temp
 
Page Directory "" onDirShow
Page InstFiles
 
Function onDirShow
FindWindow $1 "#32770" "" $HWNDPARENT ; Find inner dialog
GetDlgItem $1 $1 0x3FB
HandleFileDragDrop::Register $1 ""
FunctionEnd
 
Function InstPageDrop
DetailPrint Drop:$0
StrCpy $0 "" ; Set to empty string if you want the next file (if any)
FunctionEnd
 
Section
FindWindow $1 "#32770" "" $HWNDPARENT ; Find inner dialog
GetFunctionAddress $0 InstPageDrop
HandleFileDragDrop::Register $1 $0
SectionEnd

Remarks

In Windows Vista and later UIPI (an UI component of UAC) blocks drag & drop from low integrity processes (like Explorer) to high integrity processes (like the installer if set to require elevation). To work this around, add the following code:

System::Call 'user32::ChangeWindowMessageFilter(i563, i1)'
System::Call 'user32::ChangeWindowMessageFilter(i74, i1)'
System::Call 'user32::ChangeWindowMessageFilter(i73, i1)'

Credits

Written by Anders (For fun and profit?)

Vista+ workaround by Anonymous, with the help of https://stackoverflow.com/a/14091973