Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi Drag Drop funktioniert nicht ;( (https://www.delphipraxis.net/67732-drag-drop-funktioniert-nicht-%3B.html)

Batman666 19. Apr 2006 05:15


Drag Drop funktioniert nicht ;(
 
Nicht jedesmal kann ich auf mein Programm Objecte zB vom Desktop ziehen. Dann Programm beenden neustarten - dann geht es (oder auch nicht) woran könnt das liegen bzw. wie kann ich das beheben?!

Luckie 19. Apr 2006 07:52

Re: Drag Drop funktioniert nicht ;(
 
Ohne Code, wie du es machst, wird es schwierig dir zu helfen.

Batman666 19. Apr 2006 15:08

Re: Drag Drop funktioniert nicht ;(
 
hmm sorry - verwende diesen Code.


in der OnCreate
steht noch das DragAcceptFiles(Form1.Handle, True);

Delphi-Quellcode:

interface

procedure WMDROPFILES(var Msg: TMessage);

implementation

procedure TForm1.WMDROPFILES(var Msg: TWMDropFiles);
var
  pcFileName: PChar;
  i, iSize, iFileCount: integer;
begin
  pcFileName := ''; // to avoid compiler warning message
  iFileCount := DragQueryFile(Msg.wParam, $FFFFFFFF, pcFileName, 255);
  for i := 0 to iFileCount - 1 do
  begin
    iSize := DragQueryFile(Msg.wParam, i, nil, 0) + 1;
    pcFileName := StrAlloc(iSize);
    DragQueryFile(Msg.wParam, i, pcFileName, iSize);
    if FileExists(pcFileName) then
      AddFile(pcFileName); // method to add each file
    StrDispose(pcFileName);
  end;
  DragFinish(Msg.wParam);
end;

ste_ett 19. Apr 2006 15:38

Re: Drag Drop funktioniert nicht ;(
 
Du musst die Windows-Message abfangen.

Delphi-Quellcode:
procedure Name(var Msg: TMessage); message WM_DROPFILES;

...

procedure Name(var Msg: TMessage);
begin

end;


Alle Zeitangaben in WEZ +1. Es ist jetzt 11:43 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz