|
|
От: |
alexqc
|
![]() |
| Дата: | 29.10.03 15:59 | ||
| Оценка: | |||
P>const TCHAR* name1 = _T("c:\\temp\\mycoolfile1.txt");
P>const TCHAR* name2 = _T("c:\\temp\\mycoolfile2.txt");
P>drop_names names;
P>names.add(name1);
P>names.add(name2);
P>const TCHAR* file_names = names.lock();
P>DROPFILES drop_struct = { sizeof(drop_struct), { 0, 0 }, 0, 0 };
P>const size_t drop_size = sizeof(drop_struct) + names.size();
P>HGLOBAL drop_data = GlobalAlloc(0, drop_size);
P>unsigned char* clip_data = reinterpret_cast<unsigned char*>(drop_data);
P>memcpy(clip_data, &drop_struct, sizeof(drop_struct));
P>memcpy(clip_data + sizeof(drop_struct), file_names, names.size());
P>SendMessage(somebodycoolappwindow, WM_DROPFILES, (WPARAM)drop_data, 0);
P>P>так что мог бы и сам догадатьсяP>DROPFILES Structure
P>--------------------------------------------------------------------------------
P>Defines the CF_HDROP clipboard format. The data that follows is a double null-terminated list of file names.
int size=strlen(lpDroppedText)+2+sizeof(DROPFILES);
HGLOBAL drop_data = GlobalAlloc(GMEM_ZEROINIT | GMEM_MOVEABLE | GMEM_DDESHARE, size);
struct DROP_DATA{
DROPFILES df;
char names[1];
} *hal=(DROP_DATA*)GlobalLock(drop_data);
memset(hal,0,size);
hal->df.fNC=sizeof(DROPFILES);
strcpy(hal->names,lpDroppedText);
GlobalUnlock(drop_data);
int ret=DragQueryFile(HDROP (drop_data)
,UINT(0xFFFFFFFF), NULL,0);
GlobalFree(drop_data);