DragQueryFile() problem on Win98 [Archive] - Quintessential Forum

PDA

View Full Version : DragQueryFile() problem on Win98


Tokelil
10-06-2004, 11:22 PM
I have quite an annoing problem with drag&drop that I can't find a solution to.

To get the number of files dragged I have:
INT iNumOfFiles = DragQueryFileW(hDrop, 0xFFFFFFFF, NULL, 0);

This works fine under WinXP when dragging from QCD to QueueIt and it returns the correct number of files. But under Win98 it returns the number of chars in the string! And my code that loops through all the added songs runs through all the letters and adds them to the list as if eash letter was a track. :(
The really funny part is that it works fine if I drag from windows explore instead of QCD! Seems like QCD does something odd under W98...

Here's my code:

INT iNumOfFiles = DragQueryFileW(hDrop, 0xFFFFFFFF, NULL, 0);

CString strD;
strD.Format(L"%d", iNumOfFiles);
AfxMessageBox(strD);

// Enumerate through all files in D&D structure
for (INT i = 0; i < iNumOfFiles; i++)
{
DragQueryFile(hDrop, i, pStrFile, _MAX_PATH);
pStrUTF8File = UCS2ToUTF8(pStrFile);
// Do some stuff with the string
delete [] pStrUTF8File;
}