转至繁体中文版     | 网站首页 | 图文教程 | 资源下载 | 站长博客 | 图片素材 | 武汉seo | 武汉网站优化 | 
最新公告:     敏韬网|教学资源学习资料永久免费分享站!  [mintao  2008年9月2日]        
您现在的位置: 学习笔记 >> 图文教程 >> 软件开发 >> Delphi程序 >> 正文
网络小工具 ShareView         ★★★★

网络小工具 ShareView

作者:闵涛 文章来源:闵涛的学习笔记 点击数:8288 更新时间:2009/4/23 18:28:24
dle);
      Exit;
    end;
    NetFileClose(nil, StrToInt(FileIndex));
  end else begin
    FLibHandle := LoadLibrary(''''SVRAPI.DLL'''');
    if FLibHandle = 0 then Exit;
    @NetFileClose2 := GetProcAddress(FLibHandle, ''''NetFileClose2'''');
    if not Assigned(NetFileClose2) then
    begin
      FreeLibrary(FLibHandle);
      Exit;
    end;
    NetFileClose2(nil, StrToInt(FileIndex));
  end;
  FreeLibrary(FLibHandle);
end;

procedure GetTrafficSets(TrafficsList: TStrings);
var
  FLibHandle : THandle;
  Table: TMibIfTable;
  i : integer;
  Size   : integer;
begin
  TrafficsList.Clear;
  FLibHandle := LoadLibrary(''''IPHLPAPI.DLL'''');
  if FLibHandle = 0 then Exit;
  @GetIfTable := GetProcAddress(FLibHandle, ''''GetIfTable'''');
  if not Assigned(GetIfTable) then
  begin
    FreeLibrary(FLibHandle);
    Exit;
  end;
  Size := SizeOf(Table);
  if GetIfTable(@Table, @Size, false ) = 0 then
    for i:= 0 to Table.dwNumEntries-1 do
      TrafficsList.AddObject(Table.Table[i].bDescr, TTraffic.Create(Table.Table[i]));
  FreeLibrary(FLibHandle);
end;

function IntegerToTimeStr(Value: Integer): string;
var d, h, m, s: Real;
begin
  d := 0;
  h := 0;
  m := 0;
  s := Value;
  if s > 59 then begin
    m := int(s / 60);
    s := s - (m * 60);
  end;
  if m > 59 then begin
    h := int(m / 60);
    m := m - (h * 60);
  end;
  if h > 23 then begin
    d := int(h / 24);
    h := h - (d * 24);
  end;
  Result := '''''''';
  if (d > 0) then Result := Result + floattostr(d) + '''' d. '''';
  if (h < 9) then Result := Result + ''''0'''' + floattostr(h) + '''':'''' else Result := Result + floattostr(h) + '''':'''';
  if (m < 9) then Result := Result + ''''0'''' + floattostr(m) + '''':'''' else Result := Result + floattostr(m) + '''':'''';
  if (s < 9) then Result := Result + ''''0'''' + floattostr(s) else Result := Result + floattostr(s);
end;

{ TSessionInfo50Obj }

constructor TSessionInfo50Obj.Create(SessionInfo50: TSessionInfo50);
begin
  FSesi50_cname := SessionInfo50.Sesi50_cname;
  FSesi50_username := SessionInfo50.Sesi50_username;

end;

procedure TSessionInfo50Obj.SetSesi50_cname(const Value: WideString);
begin
  FSesi50_cname := Value;
end;

procedure TSessionInfo50Obj.Setsesi50_idle_time(const Value: Integer);
begin
  Fsesi50_idle_time := Value;
end;

procedure TSessionInfo50Obj.Setsesi50_num_opens(const Value: Integer);
begin
  Fsesi50_num_opens := Value;
end;

procedure TSessionInfo50Obj.Setsesi50_time(const Value: Integer);
begin
  Fsesi50_time := Value;
end;

procedure TSessionInfo50Obj.SetSesi50_username(const Value: WideString);
begin
  FSesi50_username := Value;
end;

{ TSessionInfo502Obj }

constructor TSessionInfo502Obj.Create(SessionInfo502: TSessionInfo502);
begin
  FSesi502_cname := SessionInfo502.Sesi502_cname;
  FSesi502_username := SessionInfo502.Sesi502_username;
  FSesi502_num_opens := SessionInfo502.Sesi502_num_opens;
  FSesi502_Time := SessionInfo502.Sesi502_time;
  Fsesi502_idle_time := SessionInfo502.Sesi502_idle_time;
end;

procedure TSessionInfo502Obj.SetSesi502_cname(const Value: WideString);
begin
  FSesi502_cname := Value;
end;

procedure TSessionInfo502Obj.Setsesi502_idle_time(const Value: DWord);
begin
  Fsesi502_idle_time := Value;
end;

procedure TSessionInfo502Obj.SetSesi502_num_opens(const Value: DWord);
begin
  FSesi502_num_opens := Value;
end;

procedure TSessionInfo502Obj.SetSesi502_Time(const Value: DWord);
begin
  FSesi502_Time := Value;
end;

procedure TSessionInfo502Obj.SetSesi502_username(const Value: WideString);
begin
  FSesi502_username := Value;
end;

{ TFileInfo3Obj }

constructor TFileInfo3Obj.Create(FileInfo3: TFileInfo3);
begin
  Ffi3_id := FileInfo3.fi3_id;
  Ffi3_permissions := FileInfo3.fi3_permissions;
  Ffi3_num_locks := FileInfo3.fi3_num_locks;
  Ffi3_pathname := FileInfo3.fi3_pathname;
  Ffi3_username := FileInfo3.fi3_username;
end;

procedure TFileInfo3Obj.Setfi3_id(const Value: DWord);
begin
  Ffi3_id := Value;
end;

procedure TFileInfo3Obj.Setfi3_num_locks(const Value: DWord);
begin
  Ffi3_num_locks := Value;
end;

procedure TFileInfo3Obj.Setfi3_pathname(const Value: WideString);
begin
  Ffi3_pathname := Value;
end;

procedure TFileInfo3Obj.Setfi3_permissions(const Value: DWord);
begin
  Ffi3_permissions := Value;
end;

procedure TFileInfo3Obj.Setfi3_username(const Value: WideString);
begin
  Ffi3_username := Value;
end;

{ TFileInfo50Obj }

constructor TFileInfo50Obj.Create(FileInfo50: TFileInfo50);
begin
  Ffi50_id := FileInfo50.fi50_id;
  Ffi50_permissions := FileInfo50.fi50_permissions;
  Ffi50_num_locks := FileInfo50.fi50_num_locks;
  Ffi50_pathname := FileInfo50.fi50_pathname;
  Ffi50_username := FileInfo50.fi50_username;
  Ffi50_sharename := FileInfo50.fi50_sharename;
end;

procedure TFileInfo50Obj.Setfi50_id(const Value: Integer);
begin
  Ffi50_id := Value;
end;

procedure TFileInfo50Obj.Setfi50_num_locks(const Value: WORD);
begin
  Ffi50_num_locks := Value;
end;

procedure TFileInfo50Obj.Setfi50_pathname(const Value: string);
begin
  Ffi50_pathname := Value;
end;

procedure TFileInfo50Obj.Setfi50_permissions(const Value: WORD);
begin
  Ffi50_permissions := Value;
end;

procedure TFileInfo50Obj.Setfi50_sharename(const Value: string);
begin
  Ffi50_sharename := Value;
end;

procedure TFileInfo50Obj.Setfi50_username(const Value: string);
begin
  Ffi50_username := Value;

end;

{ TTraffic }

constructor TTraffic.Create(MibIfRow: TMibIfRow);
begin
  FCaption := string(MibIfRow.bDescr);
  FMAC := GetMAC(TMAC(MibIfRow.bPhysAddr), MibIfRow.dwPhysAddrLen);
  FdwInOctets := MibIfRow.dwInOctets;
  FdwOutOctets := MibIfRow.dwOutOctets;
end;

procedure TTraffic.SetCaption(const Value: string);
begin
  FCaption := Value;
end;

procedure TTraffic.SetdwInOctets(const Value: Integer);
begin
  FdwInOctets := Value;
end;

procedure TTraffic.SetdwOutOctets(const Value: Integer);
begin
  FdwOutOctets := Value;
end;

procedure TTraffic.SetMAC(const Value: string);
begin
  FMAC := Value;
end;

function TTraffic.GetMAC(Value: TMAC; Length: DWORD): string;
var
  i: Integer;
begin
  if Length = 0 then Result := ''''00-00-00-00-00-00'''' else
  begin
    Result := '''''''';
    for i := 0 to Length - 2 do
      Result := Result + IntToHex(Value[i], 2) + ''''-'''';
    Result := Result + IntToHex(Value[Length - 1], 2);
  end;
end;

{ TSessionInfo2Obj }

constructor TShareInfo2Obj.Create(ShareInfo2: TShareInfo2);
begin
  Fshi2_netname := ShareInfo2.shi2_netname;
  Fshi2_path := ShareInfo2.shi2_path;
end;

procedure TShareInfo2Obj.Setshi2_netname(const Value: string);
begin
  Fshi2_netname := Value;
end;

procedure TShareInfo2Obj.Setshi2_path(const Value: string);
begin
  Fshi2_path := Value;
end;

{ TShareInfo50Obj }

constructor TShareInfo50Obj.Create(ShareInfo50: TShareInfo50);
begin
  Fshi50_netname := ShareInfo50.shi50_netname;
  Fshi50_path := ShareInfo50.shi50_path;
end;

procedure TShareInfo50Obj.Setshi50_netname(const Value: string);
begin
  Fshi50_netname := Value;
end;

procedure TShareInfo50Obj.Setshi50_path(const Value: string);
begin
  Fshi50_path := Value;
end;

end.

unit NetSendUtils;

interface

uses Classes, Windows;

  procedure GetNetGroupNameList(Names: TStrings);
  procedure GetComputerNameList(GroupName: string; Names: TStrings);

implementation

procedure GetNetGroupNameList(Names: TStrings);
var
  lphEnum: THandle;
  Buf1, Buf2: Pointer;
  Count, BufSize, Res: DWORD;
  P: ^TNetResource;
  I, J: Integer;
  List: TList;
  NetResource: TNetResource;
begin
  //获取整个网络中的文件资源的句柄,lphEnum为返回名柄
  Res := WNetOpenEnum(RESOURCE_GLOBALNET, RESOURCETYPE_DISK,
    RESOURCEUSAGE_CONTAINER, nil, lphEnum);
  if Res <> NO_ERROR then
    Exit; //执行失败
  //获取整个网络中的网络类型信息
  Count := $FFFFFFFF;                //不限资源数目
  BufSize := 8192;                   //缓冲区大小设置为8K
  Get

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]  ...  下一页 >> 


没有相关教程
教程录入:mintao    责任编辑:mintao 
  • 上一篇教程:

  • 下一篇教程:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
      注:本站部分文章源于互联网,版权归原作者所有!如有侵权,请原作者与本站联系,本站将立即删除! 本站文章除特别注明外均可转载,但需注明出处! [MinTao学以致用网]
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)

    同类栏目
    · C语言系列  · VB.NET程序
    · JAVA开发  · Delphi程序
    · 脚本语言
    更多内容
    热门推荐 更多内容
  • 没有教程
  • 赞助链接
    更多内容
    闵涛博文 更多关于武汉SEO的内容
    500 - 内部服务器错误。

    500 - 内部服务器错误。

    您查找的资源存在问题,因而无法显示。

    | 设为首页 |加入收藏 | 联系站长 | 友情链接 | 版权申明 | 广告服务
    MinTao学以致用网

    Copyright @ 2007-2012 敏韬网(敏而好学,文韬武略--MinTao.Net)(学习笔记) Inc All Rights Reserved.
    闵涛 投放广告、内容合作请Q我! E_mail:admin@mintao.net(欢迎提供学习资源)

    站长:MinTao ICP备案号:鄂ICP备11006601号-18

    闵涛站盟:医药大全-武穴网A打造BCD……
    咸宁网络警察报警平台