drag & drop onto application icon
drag & drop onto application icon
I'd like to extract a list of files dropped onto my application icon (before a window has opened). Has anyone done this?
I've searched here and seems like all related topics are about drag/dropping onto already open windows or gadgets.
Thanks for any help.
			
			
									
									
						I've searched here and seems like all related topics are about drag/dropping onto already open windows or gadgets.
Thanks for any help.
- netmaestro
 - PureBasic Bullfrog

 - Posts: 8452
 - Joined: Wed Jul 06, 2005 5:42 am
 - Location: Fort Nelson, BC, Canada
 
netmaestro, I guess you mean something like this?
I might be wrong, but I think it only works when one file dropped. For my current purpose, one file is ok but I noticed then I dropped 2 (or more) files on the icon, only one file was picked up. If anyone has a suggested improvement, would be great. Thanks.
			
			
									
									
						Code: Select all
Repeat 
  
  File$ = ProgramParameter()  ; get the next parameter (if any)
  
  MessageRequester("test","file dropped: " + File$)
    
Until ProgramParameter() = ""- netmaestro
 - PureBasic Bullfrog

 - Posts: 8452
 - Joined: Wed Jul 06, 2005 5:42 am
 - Location: Fort Nelson, BC, Canada
 
It's working fine here. Try this code version:
I ran this and selected a bunch of files, dragged them to the desktop icon which was a shortcut to the compiled program, and it processed them each in turn without fail. Copy/Paste works equally well.
			
			
									
									Code: Select all
numfiles=CountProgramParameters()
For i = 1 To numfiles
  File$ = ProgramParameter()  
  MessageRequester("test","file dropped: " + File$) 
NextBERESHEIT
						- Michael Vogel
 - Addict

 - Posts: 2821
 - Joined: Thu Feb 09, 2006 11:27 pm
 - Contact:
 
Please be careful! Command line parameters are limited (to 1020 or 2040 chars or so), so putting quit a lot of files onto an icon will make problems!
So if your program should not only interact with single files, you can also allow your program to open a window (when started without parameter) to be able to accept "real" drag and drop...
Michael.
			
			
									
									
						So if your program should not only interact with single files, you can also allow your program to open a window (when started without parameter) to be able to accept "real" drag and drop...
Michael.
- netmaestro
 - PureBasic Bullfrog

 - Posts: 8452
 - Joined: Wed Jul 06, 2005 5:42 am
 - Location: Fort Nelson, BC, Canada
 
- Michael Vogel
 - Addict

 - Posts: 2821
 - Joined: Thu Feb 09, 2006 11:27 pm
 - Contact:
 
