Some of the older applications have a feature where when it is running a filedrop icon appears on the workbench. Using that you can open files in the app by drag 'n dropping them at the icon. It is quite useful especially if the app is opened on a different screen. If I recall correctly, CodeBench does that as well.
I'd like to add that feature to one of my applications, but I don't know the logic of how this is working nor have I managed to find any info anywhere.
Has anyone done that before? Do you guys have any info to share or any documentation to point me to?
I have not done it myself, but you might look into the various Window class flags for "AppWindow", which allow reducing a window to an icon on the workbench.
I'll bet the file drop stuff begins there.
I think what you're looking for is Workbench's AddAppIcon(), which was designed specifically to support that sort of thing.
I crawled recently new and old probably intresting source-examples for this and that...
This was closest to appicon what I found for OS4.
There is section "An appicon example".
Then there is one general programmable appicon source on aminet.net, DropBox1_1.lha, wich is probably not what you are searching for. It is anyway source for OS3.
I'm personally at very beginnig to understand and learn C/Amiga-C.
When reading your post I think I know what you want and I applied it to my HexView utility. This one opens up on a screen of its own and leaves an icon on workbench for icons to be dropped on. So if my assumption is correct, then somehow I feel like being some kind of an expert in this field.
For this to implement you require a dedicated messageport that you listen to in your Wait()-cycle.
Next you need an icon to display on workbench for icons to be dropped on.
Addendum: When using a private screen, you must apply AddAppIcon()/RemoveAppIcon().
In your Wait()-cycle you need a section that gets triggered when a message appears on your dedicated port. And when that's the case, get that message. Check what kind of message you got (struct AppMessage). See
workbench/workbench.h. It's the AppMessage type (am_Type) of AMTYPE_APPICON to look for.
Then check am_NumArgs for the number of arguments (= icons dropped) you've got, which may be 0 in which case you've simply clicked the icon. Anything more is the number of icons dropped. Do you expect only 1 icon or are more icons welcome? Check!
Next you may have to verify whether the icon dropped is of of the appropriate type: load the icon's disk object (struct DiskObject) from am_ArgList (note: wa_Lock and wa_Name. See
workbench/startup.h) and check the DiskObject's do_Type against WBDISK and/or WBDRAWER and/or WBPROJECT and/or WBTOOL.
When WBPROJECT is the one you are after, then further investigation may be required as to the type or contents of the file. After all you may be only interested in, say, an IFF-file.
If everything matches you expectations, you can then proceed and perform your imagined medzjiq to the object dropped.
Thank you for your replies guys. Now I have a good idea of what to do to implement that feature in one of my projects. Will let you know if there are issues or not.