Главная страница
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.033 c
3-1094450667
Fynjy1984
2004-09-06 10:04
2004.10.03
Дерево


14-1095079217
marsden
2004-09-13 16:40
2004.10.03
А как войти зарегистрированному пользователю?


8-1088796012
Pa5ha
2004-07-02 23:20
2004.10.03
pf32bit


8-1089295741
SerBeys
2004-07-08 18:09
2004.10.03
Умножение(Multiply) цветов


1-1095691730
hamster
2004-09-20 18:48
2004.10.03
Указатель