![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
Как переташить файл на к.л. компонент программы? [D7, WinXP]
ronyn © (2005-05-05 04:09:00)Хочу переташить файл на мою программу, z.B. звуковые файлы перетащить из папки в список воспроизведения. Пожайлуста помогите. Заранее благодарен.
ronyn (2005-05-10 02:54:00) [1]ошибка устранена. Но перетаскиваемый файл не помещается в ЛистБокс. может быть с переменной aFile нужно ещё что-то делать?
Marser (2005-05-10 02:40:00) [2]
> Как же все таки необходимо избавиться от ошибки
Просто.
uses ShellAPI
ronyn (2005-05-10 02:36:00) [3]Нажал, а том вот что
The compiler could not find the given identifier - most likely it has been misspelled either at the point of declaration or the point of use. It might be from another unit that has not mentioned a uses clause.
program Produce;
var
Counter: Integer;
begin
Count := 0;
Inc(Count);
Writeln(Count);
end.
In the example, the variable has been declared as "Counter", but used as "Count". The solution is to either change the declaration or the places where the variable is used.
program Solve;
var
Count: Integer;
begin
Count := 0;
Inc(Count);
Writeln(Count);
end.
In the example we have chosen to change the declaration - that was less work.
Ничего не понятно. Как же все таки необходимо избавиться от ошибки [Error] Unit3.pas(79): Undeclared identifier: 'DragQueryFile'? Курсор остнавливается на надписи в коде - FilesCount := DragQueryFile(Message.drop, $FFFFFFFF, nil, 0);
Marser (2005-05-10 02:09:00) [4]
> ronyn (10.05.05 2:01) [5][Ответить]
Это функция API. Нажми F1
ronyn (2005-05-10 02:01:00) [5]Он требует, что бы я идентифицировал DragQueryFile. Как его прописать в разделе var, какой тип?
Antonn (2005-05-08 05:51:00) [6]ronyn (07.05.05 22:15) [2]
> //В aFile хранится путь и название файла, тут
> добавляешь как тебе надо и куда надо
под этим пишешь:
ListBox1.items.add(aFile);
easy (2005-05-07 22:38:00) [7]http://delphimaster.ru/articles/dragndrop/index.html
ronyn (2005-05-07 22:15:00) [8]Почему то не получается. По курсору видно, что файлы перетащить можно, но в ЛистБокс файлы не добавляются. Может я что-то не правильно делаю, не знаю...Хотелось бы побольше коментариев к коду, т.к. я начинающий. Заранее спасибо.
Antonn (2005-05-05 07:57:00) [9]protected
procedure CreateParams(var Params: TCreateParams); override;
private
procedure WMDropFiles(var Message: TWMDropFiles); message WM_DROPFILES;
...
procedure TForm.CreateParams(var Params: TCreateParams);
begin
inherited
CreateParams(Params);
Params.ExStyle := Params.ExStyle or WS_EX_ACCEPTFILES;
end;
procedure TForm.WMDropFiles(var Message: TWMDropFiles);
var aFile: array [0..255] of Char; FilesCount,N : Integer;
begin
inherited;
FilesCount := DragQueryFile(Message.drop, $FFFFFFFF, nil, 0);
begin
for N := 0 to FilesCount - 1 do begin
DragQueryFile(Message.drop, N, aFile, 256);
//В aFile хранится путь и название файла, тут добавляешь как тебе надо и куда надо
end;
end;
DragFinish(Message.Drop);
end;