HandleFileDragDrop plug-in: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
(New plugin, w00t, v0.1)
 
m (→‎Example: Added ini comment)
 
(2 intermediate revisions by 2 users not shown)
Line 2: Line 2:


== Links ==
== Links ==
<attach>HandleFileDragDrop_v0.1.zip</attach>
<attach>HandleFileDragDrop.zip</attach>


== Description ==
== Description ==
'''Version:''' 0.1 - 20080227<br>
'''Version:''' 0.2 - 20181123<br>
'''Supported on:''' Win95+/NT4+ (Only tested on XP, should work on any platform)
'''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)
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 ==
<highlight-nsis>
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 ; Get the handle of the control (Replace with INSTALLOPTIONS_READ ... "HWND" on a custom page)
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
</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>


== 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]]

Latest revision as of 12:41, 8 June 2022

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 ; Get the handle of the control (Replace with INSTALLOPTIONS_READ ... "HWND" on a custom page)
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