Registriert seit: 29. Mai 2002
37.621 Beiträge
Delphi 2006 Professional
|
Re: Empfänger bei WM_DROPPFILES unterscheiden
5. Mär 2010, 22:56
Leider liefert IsDragPointInside immer False.
Delphi-Quellcode:
function TfrmSteganosaur.IsDropPointInside(const aDropPoint: TPoint; const aControl: TControl): Boolean;
begin
Result := PtInRect(aControl.ClientRect, aControl.ScreenToClient({Self.}ClientToScreen(aDropPoint)));
end;
procedure TfrmSteganosaur.AppMessage(var Msg: Tmsg; var Handled: Boolean);
const
BufferLength: word = 255;
var
DroppedFilename: string;
FileIndex: Word;
QtyDroppedFiles: Word;
pDroppedFilename: array[0..255] of Char;
DropPoint: TPoint;
begin
if Msg.Message = WM_DROPFILES then
begin
FileIndex := $FFFF;
QtyDroppedFiles := DragQueryFile(Msg.WParam, FileIndex, pDroppedFilename, BufferLength);
for FileIndex := 0 to (QtyDroppedFiles - 1) do
begin
DragQueryFile(Msg.WParam, FileIndex, pDroppedFilename, BufferLength);
DroppedFilename := StrPas(pDroppedFilename);
DragQueryPoint(Msg.WParam, DropPoint);
if IsDropPointInside(DropPoint, edtCarrierFile) then
edtCarrierFile.Text := DroppedFilename
else if IsDropPointInside(DropPoint, edtTrailerFile) then
edtTrailerFile.Text := DroppedFilename;
end;
DragFinish(Msg.WParam);
Handled := true;
end;
end;
Michael Ein Teil meines Codes würde euch verunsichern.
|
|
Zitat
|