Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

having problems with $WS_EX_ACCEPTFILES


  • Please log in to reply
4 replies to this topic

#1 Shark007

Shark007

    Wayfarer

  • Active Members
  • Pip
  • 50 posts

Posted 17 February 2010 - 01:06 AM

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.

AutoIt         
#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, 17 February 2010 - 01:06 AM.








#2 PsaltyDS

PsaltyDS

    Most Venerable Penguin

  • MVPs
  • 13,279 posts

Posted 17 February 2010 - 06:31 PM

Try:
If $msg = $GUI_EVENT_DROPPED Then test()

Also, you should close out the creation of tab items with:
GUICtrlCreateTabItem("")


So, this version works:
Plain Text         
#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:
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

#3 Shark007

Shark007

    Wayfarer

  • Active Members
  • Pip
  • 50 posts

Posted 17 February 2010 - 06:53 PM

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, 17 February 2010 - 06:55 PM.


#4 PsaltyDS

PsaltyDS

    Most Venerable Penguin

  • MVPs
  • 13,279 posts

Posted 17 February 2010 - 09:13 PM

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:
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

#5 Shark007

Shark007

    Wayfarer

  • Active Members
  • Pip
  • 50 posts

Posted 17 February 2010 - 09:22 PM

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, 17 February 2010 - 09:22 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users