Files
Work/guitar/backup/20030502/DragQueryFile.hpp
2024-08-07 09:16:27 -04:00

40 lines
829 B
C++

#ifndef _COMMON_DRAGQUERYFILE_HPP_
#define _COMMON_DRAGQUERYFILE_HPP_
#ifndef _COMMON_WINDOWS_HPP_
#include <common/windows.hpp>
#endif
#ifndef _COMMON_STRING_HPP_
#include <common/string.hpp>
#endif
#ifndef _COMMON_BLOCK_HPP_
#include <common/block.hpp>
#endif
class DragQueryFile
{
public:
static bool getFileNames(HDROP hDrop,Block<String> &strFileNames);
private:
};
inline
bool DragQueryFile::getFileNames(HDROP hDrop,Block<String> &strFileNames)
{
String strBuffer;
UINT numFiles;
strFileNames.remove();
strBuffer.reserve(512);
if(0==hDrop)return false;
numFiles=::DragQueryFile(hDrop,0xFFFFFFFF,0,0);
if(!numFiles)return false;
for(int index=0;index<numFiles;index++)
{
::DragQueryFile(hDrop,index,strBuffer,512);
strFileNames.insert(&strBuffer);
}
return strFileNames.size()?true:false;
}
#endif