filerefreshactionexecute(nil);
if lvfiles.items.count <> 0 then
showmainform(nil);
end;
procedure tmainform.formshow(sender: tobject);
begin
sharerefreshactionexecute(nil);
sessionrefreshactionexecute(nil);
trafficrefreshactionexecute(nil);
filerefreshactionexecute(nil);
timer1.enabled := true;
end;
procedure tmainform.filerefreshactionexecute(sender: tobject);
var
list: tstrings;
i: integer;
os: boolean;
fileinfo3obj: tfileinfo3obj;
begin
if not isnt(os) then exit;
list := tstringlist.create;
try
getfiles(list);
lvfiles.items.beginupdate;
try
lvfiles.items.clear;
for i := 0 to list.count - 1 do
begin
fileinfo3obj := tfileinfo3obj(list.objects[i]);
if fileinfo3obj <> nil then
begin
with lvfiles.items.add do
begin
caption := list[i];
subitems.add(fileinfo3obj.fi3_pathname);
subitems.add(fileinfo3obj.fi3_username);
end;
end;
end;
finally
lvfiles.items.endupdate;
end;
finally
list.free;
end;
end;
procedure tmainform.lvsessionsmousedown(sender: tobject;
button: tmousebutton; shift: tshiftstate; x, y: integer);
begin
sessioncloseaction.enabled := (lvsessions.items.count <> 0) and (lvsessions.selected <> nil);
n15.enabled := sessioncloseaction.enabled;
end;
procedure tmainform.lvfilesmousedown(sender: tobject; button: tmousebutton;
shift: tshiftstate; x, y: integer);
begin
filecloseaction.enabled := (lvfiles.items.count <> 0) and (lvfiles.selected <> nil);
end;
procedure tmainform.filecloseactionexecute(sender: tobject);
begin
if (lvfiles.items.count = 0) or (lvfiles.selected = nil) then
exit;
if application.messagebox('确实要关闭该会话吗?', '提示', mb_yesno + mb_iconquestion) <> id_yes then
exit;
closefile(lvfiles.selected.caption);
lvfiles.items.delete(lvfiles.selected.index);
end;
procedure tmainform.n13click(sender: tobject);
var
path: string;
begin
if lvshares.selected <> nil then
begin
path := lvshares.selected.subitems[0];
shellexecute(0, 'explore', pchar(path),
nil, nil, sw_normal);
end;
end;
procedure tmainform.n15click(sender: tobject);
var
name: string;
begin
if lvsessions.selected <> nil then
begin
name := lvsessions.selected.subitems[0];
clipboard.astext := name
end;
end;
procedure tmainform.n16click(sender: tobject);
begin
if fsendtonames.indexof(fcurnode.text + '*') = -1 then
fsendtonames.add(fcurnode.text + '*');
edtoname.text := edtoname.text + fcurnode.text + '*';
end;
procedure tmainform.n19click(sender: tobject);
begin
application.terminate;
end;
procedure tmainform.n17click(sender: tobject);
begin
showmainform(nil);
end;
procedure tmainform.showmainform(sender: tobject);
begin
traynotifyicon1.hidetask := false;
end;
procedure tmainform.wmsyscommand(var msg: tmessage);
begin
if (msg.wparam = sc_close) then
msg.wparam := sc_minimize;
inherited;
if (msg.wparam = sc_minimize) then
traynotifyicon1.hidetask := true;
end;
procedure tmainform.wmhotkeyhandle(var msg: tmessage);
begin
if (msg.lparamhi = vk_return) and (msg.lparamlo = mod_control) then
begin
if btnok.enabled then
btnokclick(nil);
msg.result := 1;
end;
end;
end.
界面dfm文件
object mainform: tmainform
left = 64
top = 98
width = 921