Главная страница
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.028 c
1-1095573302
Navi
2004-09-19 09:55
2004.10.03
Правильное отображение повернутого текста


4-1093062659
ASoft
2004-08-21 08:30
2004.10.03
Система, GDI...


14-1094888235
Piter
2004-09-11 11:37
2004.10.03
Какая температура в ванной?


3-1094138777
matt
2004-09-02 19:26
2004.10.03
DBComboBox


14-1095164073
Cosinus
2004-09-14 16:14
2004.10.03
Spy++