Autor Beitrag
Tanrek
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 34



BeitragVerfasst: Do 07.07.05 09:50 
ok... wieder mal das alte thema mit dem drag n drop... aber diesmal isses etwas spezifischer... hab schon die suchen-funktion benutzt aber nichts gefunden

also: ich will, dass ich eine Verknüpung per drag n drop auf mein programm ziehen kann und dort erscheint sie, wie auf dem desktop.... also mit großem symbol, name und beim anklicken wird das gewünschte verzeichniss geöffnet, bzw programm gestartet.
soviel zum programmablauf. ich dachte bis jetzt, dass ich das mit der actiontoolbar realisieren kann, aber wie kann man das mit dem drag n drop machen? oder gibt es eine komplett andere lösung?

mfg tanrek
maxk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1696
Erhaltene Danke: 1

Win XP, Debian Lenny
Delphi 6 Personal
BeitragVerfasst: Do 07.07.05 10:26 
Hallo,
wahrscheinlich wird dir das hier helfen: www.swissdelphicente.../showcode.php?id=493


Gruß,
maxk

_________________
Ein Computer wird das tun, was Du programmierst - nicht das, was Du willst.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Do 07.07.05 10:27 
Hmm, wo liegt denn dabei das Problem, ich meine das lässt sich doch mit den ganz normalen Drag-Operationen, die schon oft genug hier im Forum diskutiert wurden, realisieren:
DragAcceptFiles -> WM_DROPFILES -> DragQueryFile -> Icon holen -> Irgendwo Button einfügen

Bei spezifischen Fragen zu einem der Teile dieses Vorgehens: Her damit, da kann ich helfen :wink:
Aber frag bitte nicht nach ALLEN :wink: , im Forum steht auch einiges...
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Do 07.07.05 10:29 
user profile iconmaxk hat folgendes geschrieben:
Hallo,
wahrscheinlich wird dir das hier helfen: www.swissdelphicente.../showcode.php?id=493

Ist allerdings viel komplizierter als nötig! Die WndProc brauchts da gar nicht, reicht ja die Direktive message...
Tanrek Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 34



BeitragVerfasst: Do 07.07.05 14:16 
danke für die antworten... werds gleich mal ausprobieren :D
Tilman
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1405
Erhaltene Danke: 51

Win 7, Android
Turbo Delphi, Eclipse
BeitragVerfasst: Do 07.07.05 14:36 
Wär nur ein Anfang, den Code zum ausführen müsstest du noch schreiben (ShellExecute).

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
unit Unit1;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs,ShellApi;
type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
    { Private-Deklarationen }
    procedure OnFileDrop(var msg: TWMDROPFILES); message WM_DROPFILES;
  public
    { Public-Deklarationen }
  end;
var
  Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.OnFileDrop;
var fName: PChar;
    fSize: Integer;
    Pos: TPoint;
    lpIcon: Word;
    Symbol: TIcon;
begin
  Symbol := TIcon.Create;
  lpIcon := 0;
  fName := strAlloc(1024);
  fSize := DragQueryFile(msg.drop,0,nil,0);
  DragQueryFile(msg.drop,0,fName,fSize+1);
  DragQueryPoint(msg.Drop,Pos);
  Symbol.Handle := ExtractAssociatedIcon(handle,fName,lpIcon);
  canvas.Draw(Pos.X,Pos.Y,Symbol);
  canvas.textout(pos.X,pos.Y+34,extractFileName(fName));
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  DragAcceptFiles(handle,true);
end;
end.
Tanrek Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 34



BeitragVerfasst: Do 07.07.05 16:05 
wow... das ist echt gut, danke :wink: