Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2004.10.03;
Скачать: CL | DM;

Вниз

Вставка скопированного или вырезанного в буфер обмена файла   Найти похожие ветки 

 
Yurik   (2004-08-27 04:59) [0]

Привет.

Подскажите, пожалуйста, как правильно вставить файл, скопированный или вырезанный в буфер обмена из проводника.

Насколько я знаю, при копировании файла в буфер обмена в проводнике Windows, буферу обмена присваивается формат CF_HDROP и помещается ссылка на имя скопированного файла (файлов), которое я получаю с помощью DragQueryFile. Это все описано в Win32 Programmers Reference, ладно. Дальше я использую SHFileOperation, дабы скопировать файл, имя которого я вытащил из буфера, в заданную папку, или же его переместить.

А вот что делать - копировать или перемещать - этого мне не известно. Это зависит от того, был файл в проводнике скопирован или вырезан. А как это узнать?

В этом вопрос.


 
Woolen ©   (2004-08-30 14:56) [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. Если системная оболочка будет заменена (а это в винде может быть), то это все работать не будет. Другие оболочки работают иначе, нежели родная.



Страницы: 1 вся ветка

Текущий архив: 2004.10.03;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.027 c
1-1095272951
Sergokkke
2004-09-15 22:29
2004.10.03
RichView


14-1095052068
DelphiN!
2004-09-13 09:07
2004.10.03
Путь к диалогу выполнить Windows-a


4-1093892608
<b>He`KTo</b>
2004-08-30 23:03
2004.10.03
Звук


14-1095322732
Kerk
2004-09-16 12:18
2004.10.03
gmail


14-1095233566
Ломброзо
2004-09-15 11:32
2004.10.03
Прикрыли почту