unit Applet1Form;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ComCtrls, ExtCtrls, Buttons, shellapi, checklst,IconDialog,
ChangeIcDialog, IconCtls, controlpanel;
type
TPanel =
class(ExtCtrls.TPanel)
private
procedure FWM_DropFiles(
var Msg: TMessage);
message WM_DROPFILES;
end;
type
TfmApplet1 =
class(TForm)
btnOK: TButton;
btnCancel: TButton;
btnApply: TButton;
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
TabSheet3: TTabSheet;
TabSheet4: TTabSheet;
TabSheet5: TTabSheet;
Label1: TLabel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Panel1: TPanel;
GroupBox1: TGroupBox;
prgpfad: TMemo;
prgname: TMemo;
Label2: TLabel;
Label3: TLabel;
prgicon: TPaintBox;
CheckListBox1: TCheckListBox;
ListView2: TListView;
BitBtn3: TBitBtn;
BitBtn4: TBitBtn;
Label4: TLabel;
ListBox1: TListBox;
Image2: TImage;
ComboBox1: TComboBox;
Label5: TLabel;
Label6: TLabel;
Edit1: TEdit;
ListView1: TListView;
procedure FormCreate(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure Panel1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
item:TListItem;
procedure addicon(
name,pfad,param:
string; icon:integer);
end;
var
fmApplet1: TfmApplet1;
implementation
uses Unit1;
{$R *.DFM}
procedure TfmApplet1.addicon(
name,pfad,param:
string; icon:integer);
begin
item:=self.listview1.items.add;
item.Caption:=name;
item.SubItems.Add(pfad);
item.subitems.add(param);
item.SubItems.add(inttostr(icon));
end;
procedure TPanel.FWM_DropFiles(
var Msg: TMessage);
var i, anzahl, size: integer;
Dateiname:
String;
begin
inherited;
Dateiname := '
';
anzahl := DragQueryFile(Msg.WParam, $FFFFFFFF,
nil, 0);
for i := 0
to (anzahl - 1)
do
begin
size := DragQueryFile(Msg.WParam, i ,
nil, 0) + 1;
SetLength(Dateiname, size);
SetLength(Dateiname, DragQueryFile(Msg.WParam,i , @Dateiname[1], size));
//hier dein source - in "Dateiname" ist der name des droped objectes
if (ExtractFileExt(dateiname)='
.exe')
or (ExtractFileExt(dateiname)='
.com')
then
begin
form1.dfsIconComboBox1.FileName:=dateiname;
form1.dfsIconComboBox1.enabled:=true;
if form1.showmodal=mrok
then
begin
fmApplet1.addicon(form1.edit1.text,dateiname,form1.edit2.text,form1.dfsiconcombobox1.itemindex);
end;
end;
end;
DragFinish(Msg.WParam);
end;
procedure TfmApplet1.FormCreate(Sender: TObject);
begin
DragAcceptFiles(panel1.handle, True);
panel1.Hint:='
Hierhin muss die Anwendung gezogen werden, die eingerichtet'+chr(13)+'
werden soll. Eine Verknüpfung funktioniert NICHT!';
end;
procedure TfmApplet1.BitBtn1Click(Sender: TObject);
begin
if listview1.SelCount>0
then
begin
Messagebox(self.handle,pchar('
Sind sie sicher, dass Sie das Programm '+listview1.selected.caption+'
löschen wollen?'),'
Frage',32);
listview1.Selected.Delete;
end else
begin
Messagebox(self.handle,'
Es ist kein Programm gewählt!','
Fehler',16);
end;
end;
procedure TfmApplet1.Panel1Click(Sender: TObject);
begin
addicon('
TEST','
TEST','
test',2);
end;
end.