Sign in to follow this  
Followers 0

having problems with $WS_EX_ACCEPTFILES

5 posts in this topic

Posted (edited)

The following code is a miniature of my app, and works as expected.

I created the mini app below for testing purposes.

My goal is to add a dropbox for files that i can work with to my working application.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

GUICreate(" My GUI input acceptfile", 320, 180, -1, -1, -1, $WS_EX_ACCEPTFILES)
GUICtrlCreateTab(4, 0, 310, 140)
GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
#Region tab
$tab = GUICtrlCreateTabItem("newtab")
$drop = GUICtrlCreateInput("", 24, 50, 180, 20)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
GUICtrlSetBkColor(-1, 0xcccccc)
GUICtrlCreateGroup("", -99, -99, 1, 1)
#EndRegion tab

#Region tab
$tab = GUICtrlCreateTabItem("newtab1")
#EndRegion tab

#Region tab
$tab = GUICtrlCreateTabItem("newtab2")
#EndRegion tab


GUISetState()

While 1
	$msg = GUIGetMsg()
	If $msg = $drop Then test()
	If $msg = $GUI_EVENT_CLOSE Then Exit
WEnd

Func test()
	MsgBox(4096, "filename", GUICtrlRead($drop))
EndFunc   ;==>test

my application is aprox 6300 lines of code.

I have been trying to troubleshoot this problem for a week already.

The moment I change

GUICreate(" My GUI", 320, 180, -1, -1)

to

GUICreate(" My GUI", 320, 180, -1, -1, -1, $WS_EX_ACCEPTFILES)

I have an obvious problem. Not only can i not make the app accept files by adding the required code, but the moment I open the executable with only this one change posted above, the application no longer opens center screen, but 1 step up as if it had opened once before it, and moved itself up a position.

If anyone could offer suggestions to assist troubleshooting this problem, I'd be very appreciative.

Edited by Shark007

Share this post


Link to post
Share on other sites



Posted

Try:

If $msg = $GUI_EVENT_DROPPED Then test()

Also, you should close out the creation of tab items with:

GUICtrlCreateTabItem("")

So, this version works:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

GUICreate(" My GUI input acceptfile", 320, 180, -1, -1, -1, $WS_EX_ACCEPTFILES)
GUICtrlCreateTab(4, 0, 310, 140)
GUICtrlSetResizing(-1, $GUI_DOCKAUTO)

$tab = GUICtrlCreateTabItem("newtab")
$drop = GUICtrlCreateInput("", 24, 50, 180, 20)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
GUICtrlSetBkColor(-1, 0xcccccc)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$tab = GUICtrlCreateTabItem("newtab1")
$tab = GUICtrlCreateTabItem("newtab2")
GUICtrlCreateTabItem("")
GUISetState()

While 1
	$msg = GUIGetMsg()
	If $msg = $GUI_EVENT_DROPPED Then test()
	If $msg = $GUI_EVENT_CLOSE Then Exit
WEnd

Func test()
	MsgBox(4096, "filename", GUICtrlRead($drop))
EndFunc   ;==>test

:mellow:

Share this post


Link to post
Share on other sites

Posted (edited)

Thanks for the advice about closing out the creation of the tab items. I was not aware of that.

What I was looking for with this posting is some advice that would to help me troubleshoot my larger application (over 6300 lines) as to why I am having difficulty in trying to add file dropping to my app.

My app works well as far as I know. I have not had any problems with it until I decided to add

-1, $WS_EX_ACCEPTFILES to GUICreate(" My GUI", 320, 180, -1, -1)

The moment I add that one thing to my application, it does weird things. Most notably, it no longer opens center screen, but top screen and, the ability to drop files is non functional even though I add all the required commands etc.

Edited by Shark007

Share this post


Link to post
Share on other sites

Posted

See the first item in my earlier post for why drop file wasn't detected. You were watching for the wrong GUI message.

The working demo I posted doesn't do anything strange for me. Does it work correctly in your environment?

:mellow:

Share this post


Link to post
Share on other sites

Posted (edited)

The script in my 1st post works, as does the modified script you posted. And I thank you for your interest in helping me find a resolution. The problem I am having is that I cannot get to drag n drop to work in another script that is 6300 lines long.

I was hoping a seasonned user would spot an obvious reason why I cannot get it to work.

When I change GUICreate("My GUI", 320, 180, -1, -1)

to GUICreate("My GUI", 320, 180, -1, -1, -1, $WS_EX_ACCEPTFILES)

I immediately begin to have problems in my 6300 line script.

The moment I make that one change to my application, it starts to do weird things. Most notably, it no longer opens center screen, but opens at the top of the screen and the ability to drop files is non functional even though I add all the required commands.

Edited by Shark007

Share this post


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
Sign in to follow this  
Followers 0