网络小工具 ShareView[12]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 lyris 的 blog

    hint := application.title;
    ondblclick := showmainform;
    popupmenu := popupmenu1;
    hidetask := false;
    iconvisible := true;
  end;
  hotkeyid := globaladdatom('userdefinehotkey') - $c000;
  registerhotkey(handle, hotkeyid, mod_control, vk_return);
end;

procedure tmainform.formdestroy(sender: tobject);
begin
  fsendtonames.free;
  traynotifyicon1.free;
  unregisterhotkey(handle, hotkeyid);
  deleteatom(hotkeyid);
end;

procedure tmainform.btncloseclick(sender: tobject);
begin
  application.terminate;
end;

procedure tmainform.btnokclick(sender: tobject);
var
  i, j: integer;
begin
  statusbar1.simpletext := '';
  for i := 0 to fsendtonames.count - 1 do
  begin
    j := sendtextmessage(fsendtonames[i], edfrom.text, memocontents.lines.text);
    if j <> 0 then
      statusbar1.simpletext := statusbar1.simpletext + fsendtonames[i] + ' ';
  end;
  if statusbar1.simpletext <> '' then statusbar1.simpletext := statusbar1.simpletext + '没有收到';
end;

procedure tmainform.edtonamechange(sender: tobject);
var
  namelist: tstrings;
  i: integer;
begin
  namelist := tstringlist.create;
  try
    namelist.commatext := edtoname.text;
    for i := (fsendtonames.count - 1) downto 0 do
    begin
      if namelist.indexof(fsendtonames[i]) = -1 then
        fsendtonames.delete(i);
    end;
    if edtoname.text <> fsendtonames.commatext then
    begin
      fsendtonames.assign(namelist);
      edtoname.text := fsendtonames.commatext;
    end;
  finally
    namelist.free;
  end;
  btnok.enabled := trim(edtoname.text) <> '';
end;

procedure tmainform.sharerefreshactionexecute(sender: tobject);
var
  list: tstrings;
  i: integer;
  os: boolean;
  shareinfo2obj: tshareinfo2obj;
begin
  if not isnt(os) then exit;
  list := tstringlist.create;
  try
    getshares(list);
    lvshares.items.beginupdate;
    try
      lvshares.items.clear;
      for i := 0 to list.count - 1 do
      begin
        shareinfo2obj := tshareinfo2obj(list.objects[i]);
        if shareinfo2obj <> nil then
        begin
          with lvshares.items.add do
          begin
            caption := list[i];
            subitems.add(shareinfo2obj.shi2_path);
          end;
        end;
      end;
    finally
      lvshares.items.endupdate;
    end;
  finally
    list.free;
  end;
end;

procedure tmainform.sharecloseactionexecute(sender: tobject);
begin
  if (lvshares.items.count = 0) or (lvshares.selected = nil) then
    exit;
  if application.messagebox('确实要关闭该共享吗?', '提示', mb_yesno + mb_iconquestion) <> id_yes then
    exit;
  closeshare(lvshares.selected.caption);
  lvshares.items.delete(lvshares.selected.index);
end;

procedure tmainform.lvsharesmousedown(sender: tobject;
  button: tmousebutton; shift: tshiftstate; x, y: integer);
begin
  sharecloseaction.enabled := (lvshares.items.count <> 0) and (lvshares.selected <> nil);
  n13.enabled := sharecloseaction.enabled;
end;

function selectdirectory: string;
var
  lpitemid: pitemidlist;
  browseinfo: tbrowseinfo;
  displayname: array[0..max_path] of char;
  temppath: array[0..max_path] of char;
begin
  fillchar(browseinfo, sizeof(tbrowseinfo), #0);
  browseinfo.hwndowner := mainform.handle;
  browseinfo.pszdisplayname := @displayname;
  browseinfo.lpsztitle := '请选择共享目录:';
  browseinfo.ulflags := bif_returnonlyfsdirs;
  lpitemid := shbrowseforfolder(browseinfo);

本文关键:网络小工具 ShareView
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top