Jump to content

Drag File onto GUI Background


Recommended Posts

I'm trying to drag and drop a file onto my GUI without hitting any particular control. I tried capturing it with the $GUI_EVENT_DROPPED event, but that only catches files dropped onto controls. Is there a way to see files dropped onto the background? I've seen a few topics related to this, but all of them are trying to drop onto a control 😐

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts

Link to post
Share on other sites

There

#include <Constants.au3>
#include <GUIConstants.au3>

Local $hGUI = GUICreate ("Test", 300, 300, -1, -1,-1, $WS_EX_ACCEPTFILES)
Local $idDummy = GUICtrlCreateLabel ("",0,0,300,300)
GUICtrlSetState(-1, $GUI_DROPACCEPTED+$GUI_DISABLE)
Local $idButton = GUICtrlCreateButton ("OK", 100,200,100,30)

GUISetState ()

While True
  Switch GUIGetMsg ()
    Case $GUI_EVENT_CLOSE, $idButton
      ExitLoop
    Case $GUI_EVENT_DROPPED
      ConsoleWrite ("dropped " & @GUI_DropId & @CRLF)
  EndSwitch
WEnd

 

Link to post
Share on other sites

Oh, that's genius... thank you! I thought a disabled control would be visible and not take events.

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...