776___________________________Часть V. Инструментарий программиста

///./////////////////////////////////////////////////////////////// / / ResTextApp::CmHelpAbout() //

// Обработчик команды "?", "О программе" void ResTextApp::CmHelpAbout() (

ResTextAboutDIg(MainWindow).Execute() ;

}

//////////////////////////////////////////////////////////////////

// ResTextApp::EvDropFiles()

// . ' ' • •

// Обработчик Drag/drop

void ResTextApp::EvDropFiles(TDropInfo drop)

{ .

// Число "опущенных" файлов

int totalNumberOfFiles = drop.DragQueryFileCount();

// Список опущенных файлов • TFileList* files = new TFileList;

for (int i = 0; i < totalNumberOfFiles; i++) {

// Получить длину имени файла и само имя

int fileLength = drop.DragQueryFileNameLen(i) + 1;

char *fileName = new char[fileLength] ;

drop.DragQueryFilefi, fileName, fileLength);

// Получить позицию опускания файла и посмотреть, // попадает ли она в клиентскую область TPoint point;

bool inClientArea = drop.DragQueryPoint(point);

// Добавить опущенный файл к списку файлов files->Add(new TFileDropffileName, point, inClientArea, this) ) ;

}

AddFiles(files) ;

// Освободить память, занятую этим обработчиком drop.DragFinish();

}

//////////////////////////////////////////////////////////////////

// ResTextApp::AddFiles()

//

// Обработчик Drag/drop

void ResTextApp::AddFiles(TFileList* files)

(

// Открыть все опущенные файлы

TFileListIter filelter(*files);