Форум: "Сети";
Текущий архив: 2002.12.16;
Скачать: [xml.tar.bz2];
ВнизLocal Network WorkGroups Найти похожие ветки
← →
slaventii (2002-10-18 12:04) [0]Dobrogo vremeni sutok vam!!!
Esti localinaia setka. Esti 2 rabocih gruppi. Mne nujno (programmno :)) poluci spisok etih grupp.
Prosmatrel vesi forum.. Nashol znamenituiu, populearneishuiu, :) FindComputers(Workgroup: string)..
Poproboval, rabotaet.. Vidaeot spisok resursov, esli ia
zadaiu parametr Workgroup := imea grupi.. s etim nema trablov.
Kto-to napisal, shto esli Workgroup := ""; to vidast spisok vseh rabocih group, poproboval, vidaeot
"Microsoft Terminal Services"
"Microsoft Windows NetWork"
"Microsoft Web......"
Dalishe, poproboval, WorkGroup := "Microsoft Windows NetWork"
toje mimo... moje ya cio-to upuskaiu s vidu, moje kto podskajet..
Vot function
function TForm1.EnumRes( hwnd: HWND; lpnr: TNetResource ): Boolean;
var
hEnum, dwResult, dwResultEnum : DWORD;
lpnrLocal : array [0..16384 div SizeOf(TNetResource)] of TNetResource; // pointer to enumerated structures
i : integer;
cEntries : Longint;
cbBuffer : DWORD; // 16K is a good size
tmp_res : TNetResource;
begin
cbBuffer := 16384;
centries := -1; // enumerate all possible entries
FillChar(tmp_res, SizeOf(tmp_res), 0);
with tmp_res do begin
dwScope := RESOURCE_CONNECTED;
dwType := RESOURCETYPE_ANY;
dwDisplayType := RESOURCEDISPLAYTYPE_DOMAIN;
dwUsage := RESOURCEUSAGE_CONNECTABLE;
lpRemoteName := "";
end;
// Call the WNetOpenEnum function to begin the enumeration.
dwResult := WNetOpenEnum(
RESOURCE_GLOBALNET, // Enumerate currently connected resources.
RESOURCETYPE_DISK, // all resources
0, // enumerate all resources
@tmp_res, // NULL first time the function is called
hEnum // handle to the resource
);
if (dwResult <> NO_ERROR) then
begin
// Process errors with an application-defined error handler
ShowMessage("Network ERROR");
Result := False;
Exit;
end;
// Initialize the buffer.
FillChar( lpnrLocal, cbBuffer, 0 );
// Call the WNetEnumResource function to continue
// the enumeration.
dwResultEnum := WNetEnumResource(hEnum, // resource handle
DWORD(cEntries), // defined locally as -1
@lpnrLocal, // LPNETRESOURCE
cbBuffer); // buffer size
// This is just printing
for i := 0 to cEntries - 1 do
begin
// loop through each structure and
// get remote name of resource... lpnrLocal[i].lpRemoteName)
lb1.Items.Add(lpnrLocal[i].lpRemoteName);
end;
// Call WNetCloseEnum to end the enumeration.
dwResult := WNetCloseEnum(hEnum);
if(dwResult <> NO_ERROR) then
begin
// Process errors... some user defined function here
Result := False;
end
else
Result := True;
end;
← →
Slaventii (2002-10-18 13:15) [1]Kajisi razobralsea..
v structure TNetResourse (tmp_res)
dal zanacenie lpProvider := "Microsoft Windows Network"
i vidal..mne gruppi..
← →
Rouse_ (2002-10-18 22:33) [2]Вот посмотри как это сделано у меня на основе потока чтобы не тормозила главная программа, ловит вообще все
unit uCompShares;
interface
uses
Classes, Windows, ComCtrls, SysUtils, Registry, ShellAPI;
type
TSockScanThr = class(TThread)
private
protected
procedure update;
procedure Execute; override;
public
end;
type
TOpenShares = class(TThread)
private
protected
procedure Execute; override;
public
Path : String;
end;
procedure Scan(res: TNetResource; root: boolean);
var
StartThread: Boolean;
s:TStringList;
implementation
uses frmMain;
procedure TSockScanThr.update;
var I,ii, lev, Cnt:Integer;
Result, ShowAll, ShowPanel: Boolean;
TmpNode, TmpChild, tt: TTreeNode;
Root:String;
begin
Form1.IncError; Form1.ErrorCodeZool := "Error code M0001";
if Assigned(Form1.TreeView2.Selected) then begin
try
tt:=Form1.TreeView2.Selected;
lev:=Form1.TreeView2.Selected.Level;
root:="";
if Lev = 0 then begin
root := Form1.TreeView2.Selected.Text;
end else begin
for i:=tt.absoluteIndex downto 0 do begin
if Form1.TreeView2.Items.item[i] .level = 0 then break;
end;
root:=Form1.TreeView2.Items.item[i].text;
end;
except end;
end;
//Form1.Label38.Caption := Root;
ShowAll := False;
with TRegistry.Create do begin
RootKey := HKEY_CURRENT_USER;
OpenKeyReadOnly("Software\Fangorn Wizards Lab\Zool\MainSetting");
if ValueExists("ShowAllServers") then
if ReadBool("ShowAllServers") then
ShowAll := True;
Free;
end;
ShowPanel := False;
Cnt := 0;
Form1.Label38.Caption := "
Страницы: 1 вся ветка
Форум: "Сети";
Текущий архив: 2002.12.16;
Скачать: [xml.tar.bz2];
Память: 0.46 MB
Время: 0.007 c