Home > Software engineering >  Use ole drag and drop how to obtain the target path or how to delay drag-and-drop questions
Use ole drag and drop how to obtain the target path or how to delay drag-and-drop questions

Time:10-14

Recently in dealing with the problem about ole drag and drop (win32/64 program on Windows, not MFC support), part of drag and drop into the program has processing is completed, about the function of the drag and drop out, the realization of the general is no problem, but the problem is how to achieve the effect of drag, delay

It means that when the DoDragDrop method is complete, press the mouse drag and drop has been released, but as the dragged object does not exist when how to deal with, for example, is a drag and drop a file from the application out, but at the moment, the file does not exist, or to download or need to unpack, so in the file on the local processing good, how to realize the drag and drop the position of the file appear in the original?

About this question, I think there are two ideas:
A is the rub, the drag finished record the current mouse position and the window, in the local file handle, simulated put the file to the recording again, but this way is not very heavy operation, for desktop to drag the position, to record folder path, the most important thing is that if it is a drag and drop into the other programs support drag and drop do not delay implementation way,

2 is always looking for but didn't find the method of Windows itself whether to have this delay drag-and-drop support functions, I think is some, because of the delays drag has been a lot of application implements, the most typical is the compression software, regardless of where the files in the compressed file drag or which program, he can normally will file into temporary folder first, and then drag and drop the files to at the beginning of the target site, just don't know what's his method,

On method 2, check a lot of information on the Internet didn't find the direction, and Delay two word smacks of MFC encapsulation COleDataSource, COleDataObject, COleDataTarget DelayRenderData series, OnDelayRenderData method also tried, but whether to use or see the source code, the Delay line can only Delay to drag and drop, once the DoDragDrop method returns, the Delay was finally no longer be called back, also don't know if I understand there is a problem,

I hope you can give some guidance advice,

CodePudding user response:

Impossible, DoDragDrop return drag is complete, what do you mean, the source or the target of the container is explorer. Exe, who know exactly how to do this, can only slowly try, estimated to DoDragDrop IDataObject shell information related to add

CodePudding user response:

I use a means of indirect realized from my software to copy, paste into the resource manager and then put some of the data to the target in my software become file, don't know what you want to do is what east east, I am watching 360 cloud disk copy files to the resource manager, try yourself

CodePudding user response:

The past is not a file, but an action to be performed.

CodePudding user response:

Sending files at the moment, I also met this problem, the original poster can provide the drag and drop files to the target window function source code?

CodePudding user response:

I also have a similar problem, various solution without common sense, drag and drop question is delay, COleDataSource: : OnRenderFileData CFile in () function is a Share file, is not really the target file, so I want to find target directory of drag and drop through CFile, delay drag for file implementation has no problems, fill in the file list in the OnBeginDrag information, you should write in OnRenderFileData function can be written about CFile, drag and drop to achieve the directory, however, I cannot be achieved at present, in the OnBeginDrag fill in file and directory information is no problem, but can generate directory, generate a file, still in OnRenderFileData CFile to write, but will all the documents to create to the desktop (such as drag desktop), and unable to retain the original file directory hierarchy,

CodePudding user response:

The building Lord, I also encountered such a problem, you finally is how to solve? Can you share
  • Related