![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
Вставка скопированного или вырезанного в буфер обмена файла
Yurik © (2004-08-27 04:59:00)Привет.
Подскажите, пожалуйста, как правильно вставить файл, скопированный или вырезанный в буфер обмена из проводника.
Насколько я знаю, при копировании файла в буфер обмена в проводнике Windows, буферу обмена присваивается формат CF_HDROP и помещается ссылка на имя скопированного файла (файлов), которое я получаю с помощью DragQueryFile. Это все описано в Win32 Programmers Reference, ладно. Дальше я использую SHFileOperation, дабы скопировать файл, имя которого я вытащил из буфера, в заданную папку, или же его переместить.
А вот что делать - копировать или перемещать - этого мне не известно. Это зависит от того, был файл в проводнике скопирован или вырезан. А как это узнать?
В этом вопрос.
Woolen (2004-08-30 14:56:00) [1]Microsoft об этоми говорит:
The basic procedure for a delete-on-paste operation is as follows:
1. The source marks the screen display of the selected data.
2. The source creates a data object. It indicates a cut operation by adding the CFSTR_PREFERREDDROPEFFECT format with a data value of DROPEFFECT_MOVE.
3. The source places the data object on the Clipboard using OleSetClipboard.
4. The target retrieves the data object from the Clipboard using OleGetClipboard.
5. The target extracts the CFSTR_PREFERREDDROPEFFECT data. If it is set to only DROPEFFECT_MOVE, the target can either do an optimized move or simply copy the data.
6. If the target does not do an optimized move, it calls the IDataObject::SetData method with the CFSTR_PERFORMEDDROPEFFECT format set to DROPEFFECT_MOVE.
7. When the paste is complete, the target calls the IDataObject::SetData method with the CFSTR_PASTESUCCEEDED format set to DROPEFFECT_MOVE.
8. When the source's IDataObject::SetData method is called with the CFSTR_PASTESUCCEEDED format set to DROPEFFECT_MOVE, it must check to see if it also received the CFSTR_PERFORMEDDROPEFFECT format set to DROPEFFECT_MOVE. If both formats are sent by the target, the source will have to delete the data. If only the CFSTR_PASTESUCCEEDED format is received, the source can simply remove the data from its display. If the transfer fails, the source updates the display to its original appearance.
От этого и отталкивайся. Мне кажется, ты изначально взял не то направление.
PS. Если системная оболочка будет заменена (а это в винде может быть), то это все работать не будет. Другие оболочки работают иначе, нежели родная.