unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,menus, StdCtrls,shellapi, CoolTrayIcon;
type
TForm1 =
class(TForm)
PopupMenu1: TPopupMenu;
CoolTrayIcon1: TCoolTrayIcon;
beenden1: TMenuItem;
procedure FormCreate(Sender: TObject);
procedure beenden1Click(Sender: TObject);
private
{ Private declarations }
public
{procedure HandleLBtnDn(var msg: TMessage); message WM_LBUTTONDOWN;}
procedure WMNCHitTest(
var msg: TWMNCHitTest);
procedure PopupMenuItemsClick(Sender: TObject);
end;
var
neuform:tform;
Form1: TForm1;
sl2:tstringlist;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var sl3:tstringlist;
sl1:tstringlist;
i,m:integer;
pm:tpopupmenu;
newitem:tmenuitem;
bm:tbitmap;
hwndOwner: HWnd;
begin
sl3:=tstringlist.create;
sl2:=tstringlist.Create;
sl1:=tstringlist.create;
sl1.loadfromfile('
count.cnt');
for i:=1
to strtoint(sl1[0])
do
begin
sl3.loadfromfile('
mens/pos'+inttostr(i)+'
.txt');
sl2.LoadFromFile('
mens/'+inttostr(i)+'
.txt');
neuform:=tform.Create(form1);
with neuform
do
begin
bm:=tbitmap.create;
bm.LoadFromFile('
mens/'+inttostr(i)+'
.bmp');
name:='
nform'+inttostr(i);
top:=strtoint(sl3[1]);
left:=strtoint(sl3[0]);
borderstyle:=bsnone;
height:=32;
width:=32;
pm:=tpopupmenu.create(self);
with pm
do
for m :=0
to (sl2.Count
div 2) -1
do
begin
NewItem := TMenuItem.Create(pm);
Items.Add(NewItem);
NewItem.Caption := sl2[m*2];
NewItem.Tag := m;
NewItem.OnClick := PopupMenuItemsClick;
name:='
pm'+inttostr(i);
end;
popupmenu:=pm;
show;
canvas.Draw(0,0,bm);
end;
end;
width:=0;
height:=0;
sl1.clear;
sl3.clear;
sl2.Clear;
hwndOwner := GetWindow(
Handle, GW_OWNER);
ShowWindow(hwndOwner, SW_HIDE);
ShowWindowAsync(hwndOwner, SW_HIDE);
ShowWindowAsync(Self.Handle, SW_HIDE);
end;
procedure TForm1.PopupMenuItemsClick(Sender: TObject);
var x:tmenu;
begin
x:=TMenuItem(Sender).GetParentMenu;
sl2.LoadFromFile('
mens/'+inttostr((x.componentindex
div 2) - 1)+'
.txt');
with Sender
as TMenuItem
do
begin
ShellExecute(
Handle, '
open',pchar(sl2[(tag*2+1)]) ,
nil,
nil, SW_SHOW);
end;
end;
procedure TForm1.WMNCHitTest(
var msg: TWMNCHitTest);
begin
inherited;
if msg.Result = htClient
then
msg.Result := htCaption;
end;
procedure TForm1.beenden1Click(Sender: TObject);
begin
application.terminate;
end;
{procedure TForm1.HandleLBtnDn(var msg: TMessage);
begin
Sendmessage(Self.Handle, WM_NCLBUTTONDOWN, HTCAPTION, msg.LParam);
end;}
end.