Jump to content
Dany Marmur

Sharing in Win32 VCL, TShareContract or TSendEmail?

Recommended Posts

Hi All,


The title is a bit ironic, please read on.


My application can create a lot of different files from different places using different buttons. My users would like to mail, (share), these files in one go (almost exclusively one file at a time). The Project is on 10.4.2 Pro, DevExpress, 2 DACs, RTC, FastReports and some more.


I have looked at the Sydney Demo "TShareContract". This new "UWP" style of "sharing" seems to work really badly in an office environment using Outlook Desktop (for example, but an important example). Try googling it 🙂


Another options is to incorporate The Drag-and-Drop (OLE) suite. I had it in an older application, and i have nothing against the library, but i'm really trying to keep 3rd party libs at a minimum. Drag and drop, however, works pretty good with outlook as they can drag an attachment to the unsent e-mail. And also to folders and other applications. I am thinking that setting up a DragDrop Source in a "Drag Me" control should be the best user experience, but implementing the creation of the file(s) at drag start and implementing all the nuisances is really not what i have time for atm.


One can of course automate an Outlook client using OLE, been there 2 centuries ago, it was not fully appreciated and nowadays i do not want to invest time and code in *one* mail client alone. I even did that with GroupWise(!) once. On the same note is using a Cloud connector directly to Exchange would deprive the user of the possibility to amend the e-mail before it's sent.


Moving on (backwards?) there's the TSendMail (action) that uses Simple MAPI (?). But Outlook usually warns the user about "some application trying to"... increasing the workload for the IT-admin. This however, seems to be the alternative that will cost me the least amount of time.


DevExpress has a ShellListView that provides all the goodies from the shell (send to mail, drag-and-drop), but then that will use screen real-estate and users would have to know what file to choose. It seems more confusing to users than helpful.


I have access to DevExpress, they have some cloud-y things that i have not had time to read about. I also know the FastReport has some support, but those demos are a *¤#"# to run because of the dependencies on stuff i do not want to install.


I'm asking because i do not have much time for the fancy or special solutions and debugging, and i need to implement something rather fast.

I will probably come back to a better solution in ½ a year.

Anyone have better ideas, would be very welcome!





Share this post

Link to post
Posted (edited)

hi @Dany Marmur


did you have tryed Indy class/component for send yours emails? 


for Drag'n'Drop you can find many sources (components/class ready for use) on GitHub


about Shell, I dont have word about a better or not for use



Edited by Guest

Share this post

Link to post
13 hours ago, emailx45 said:

or Drag'n'Drop you can find many sources

I searched on "drag drop delphi" but essentially only versions of the Drag-and-drop suite and some that are not pertinent.

Do you have a better search string?



Share this post

Link to post

I have now implemented a minimalist DropSource unit. I assumed it would be much more work (kind of premature optimisation but the other way around).

Each time a (FR) report is prepared in one of the the "preview areas" (visual) a thread goes off and does an export to a selected number of formats.

Each format has a drag control that the tread will notify to enable when the file(s) are/is available.

After that the end user can drag from the "button" to almost anywhere.

There's a lag of 0,5 to 2 second before the drag source light up, but that is no problem, just look kind of cool.


Now i just have to implement cleanup and some way of determining when to disable the drag sources.




Thanks you all!



Share this post

Link to post
5 hours ago, Dany Marmur said:

Now i just have to implement cleanup and some way of determining when to disable the drag sources.

Wouldn't it be on "DragDrop" event? Here, it's where the object is "accept or not" if you determine that "Source class" will be accept on target.




I have a "Spy" (basic code) that it can to know what class is under my mouse. But, of course, needs more code for works with "drag'n'drop" for example!








Share this post

Link to post

Instead of preconstructing the different formats so they are ready when the drag start, you could defer the creation and have the drop target initiate the creation when it requests the data. If it only takes ~2 seconds to create the data then that shouldn't be much of a problem and that also solves the problem of when to delete the source data; Delete it when the target closes the source stream - or if the drop is synchronous, when the drop completes.

The D&D Suite has several examples that uses this technique... 🙂

Share this post

Link to post

@emailx45, imagine there's a preview. Actually there can be several. Each one should be draggable. Also each one should be draggable more that once. So my cleanup must be connected to when/if these previews are closed or re-built.

@Anders Melander, i remember this "option", yes. It will help me but only with sleekness and stability, not with cleanup. I'll revisit all of this when i will be allowed time (as with so much else).


As you can understand cleanup is tightly coupled with my own design so nothing that a forum can help me with.



Share this post

Link to post

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