Click here to Skip to main content
15,887,988 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: OnDropFiles() problem Pin
Parthi_Appu27-Mar-07 17:32
Parthi_Appu27-Mar-07 17:32 
GeneralRe: OnDropFiles() problem Pin
ghunzel0627-Mar-07 17:47
ghunzel0627-Mar-07 17:47 
GeneralRe: OnDropFiles() problem Pin
Parthi_Appu27-Mar-07 17:50
Parthi_Appu27-Mar-07 17:50 
GeneralRe: OnDropFiles() problem Pin
Naveen27-Mar-07 18:17
Naveen27-Mar-07 18:17 
GeneralRe: OnDropFiles() problem Pin
ghunzel0627-Mar-07 18:56
ghunzel0627-Mar-07 18:56 
GeneralRe: OnDropFiles() problem Pin
Parthi_Appu27-Mar-07 19:19
Parthi_Appu27-Mar-07 19:19 
AnswerRe: OnDropFiles() problem Pin
Stephen Hewitt27-Mar-07 17:23
Stephen Hewitt27-Mar-07 17:23 
GeneralRe: OnDropFiles() problem Pin
ghunzel0627-Mar-07 17:50
ghunzel0627-Mar-07 17:50 
void CLaunchDlg::OnDropFiles(HDROP dropInfo)
{
// Get the number of pathnames that have been dropped
WORD wNumFilesDropped = DragQueryFile(dropInfo, -1, NULL, 0);

CString firstFile= _T("");

// get all file names. but we'll only need the first one.
for (WORD x = 0 ; x < wNumFilesDropped; x++) {

// Get the number of bytes required by the file's full pathname
WORD wPathnameSize = DragQueryFile(dropInfo, x, NULL, 0);

// Allocate memory to contain full pathname & zero byte
WCHAR* npszFile = (WCHAR*) LocalAlloc(LPTR, sizeof(WCHAR) * (wPathnameSize + 1));

// If not enough memory, skip this one
if (npszFile == NULL) continue;

// Copy the pathname into the buffer
DragQueryFile(dropInfo, x, npszFile, wPathnameSize + 1);

// we only care about the first
firstFile=npszFile;

// clean up
LocalFree(npszFile);
}

SetWindowText(firstFile);
}


That's the handler of the Custom Edit Control, CDropEdit.

Any ideas?

Thanks!
GeneralRe: OnDropFiles() problem Pin
Parthi_Appu27-Mar-07 17:56
Parthi_Appu27-Mar-07 17:56 
GeneralRe: OnDropFiles() problem Pin
ghunzel0627-Mar-07 18:20
ghunzel0627-Mar-07 18:20 
GeneralRe: OnDropFiles() problem Pin
David Crow28-Mar-07 3:00
David Crow28-Mar-07 3:00 
GeneralRe: OnDropFiles() problem Pin
Stephen Hewitt27-Mar-07 17:58
Stephen Hewitt27-Mar-07 17:58 
GeneralRe: OnDropFiles() problem Pin
ghunzel0627-Mar-07 18:45
ghunzel0627-Mar-07 18:45 
GeneralRe: OnDropFiles() problem Pin
Stephen Hewitt27-Mar-07 18:53
Stephen Hewitt27-Mar-07 18:53 
GeneralRe: OnDropFiles() problem Pin
ghunzel0627-Mar-07 19:06
ghunzel0627-Mar-07 19:06 
QuestionSetTimer before CreateWindow() Pin
LiYS27-Mar-07 16:48
LiYS27-Mar-07 16:48 
AnswerRe: SetTimer before CreateWindow() Pin
Stephen Hewitt27-Mar-07 17:09
Stephen Hewitt27-Mar-07 17:09 
GeneralRe: SetTimer before CreateWindow() [modified] Pin
LiYS27-Mar-07 17:22
LiYS27-Mar-07 17:22 
GeneralRe: SetTimer before CreateWindow() Pin
Stephen Hewitt27-Mar-07 17:26
Stephen Hewitt27-Mar-07 17:26 
GeneralRe: SetTimer before CreateWindow() Pin
LiYS27-Mar-07 17:43
LiYS27-Mar-07 17:43 
GeneralRe: SetTimer before CreateWindow() [modified] Pin
LiYS27-Mar-07 19:45
LiYS27-Mar-07 19:45 
GeneralRe: SetTimer before CreateWindow() Pin
Stephen Hewitt27-Mar-07 19:53
Stephen Hewitt27-Mar-07 19:53 
Questionfloating-point to hex conversion Pin
morocco21227-Mar-07 12:03
morocco21227-Mar-07 12:03 
AnswerRe: floating-point to hex conversion Pin
cp987627-Mar-07 14:19
cp987627-Mar-07 14:19 
GeneralRe: floating-point to hex conversion Pin
morocco21228-Mar-07 2:58
morocco21228-Mar-07 2:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.