antiufo Posted September 3, 2007 Posted September 3, 2007 How can I create a GUI that: * Has no input controls * Accepts dropped files everywhere * when a file is dropped on any point of the window, call a function with the path of the file as parameter? thanks.
smashly Posted September 3, 2007 Posted September 3, 2007 Cover your GUI with a disabled transparent label and use the label to register the drop.eg:#include <GUIConstants.au3> $Gui = GUICreate("Drop 'N' ShellExecute", 300, 200, -1, -1, -1, $WS_EX_ACCEPTFILES + $WS_EX_TOPMOST) $CatchDrop = GUICtrlCreateLabel("", -1, -1, 300, 200) GUICtrlSetState(-1, $GUI_DISABLE + $GUI_DROPACCEPTED) GUISetState(@SW_SHOW, $Gui) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $GUI_EVENT_DROPPED If StringRight(@GUI_DRAGFILE, 4) = ExtFilter(StringRight(@GUI_DRAGFILE, 4)) Then ShellExecute(@GUI_DRAGFILE) EndIf EndSelect WEnd Func ExtFilter($iExt) $SSEXT = StringSplit(".exe|.jpg|.mp3|.txt", "|") For $i = 1 To $SSEXT[0] If $SSEXT[$i] = $iExt Then Return $iExt Next Return 0 EndFunc Cheers
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now