Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Сети";
Текущий архив: 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
3-51588
User_OKA
2002-11-27 13:00
2002.12.16
Запрос


1-51662
white
2002-12-05 15:39
2002.12.16
Random


14-51894
VictorT
2002-11-22 21:54
2002.12.16
Блин, невезуха, не знаю чё делать.


14-51903
greenrul
2002-11-22 17:23
2002.12.16
Кто что курит?


1-51762
DmitryMN
2002-12-04 16:12
2002.12.16
Вывод в Excel





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский