Registriert seit: 1. Jul 2004
Ort: Oberottmarshausen
57 Beiträge
Delphi 6 Professional
|
Re: es wird keine arbeitsgruppe ausgelesen
16. Dez 2004, 12:22
oh
ich hab gerade bei SwissDelphiCenter eine methode gefunden die geht.
Delphi-Quellcode:
function NetServerGetInfo (serverName : PWideChar; level : Integer;
var bufptr : Pointer) : Cardinal; stdcall; external 'NETAPI32.DLL';
function NetApiBufferFree (buffer : Pointer) : Cardinal; stdcall; external 'NETAPI32.DLL';
type
SERVER_INFO_503 = record
sv503_sessopens : Integer;
sv503_sessvcs : Integer;
sv503_opensearch : Integer;
sv503_sizreqbuf : Integer;
sv503_initworkitems : Integer;
sv503_maxworkitems : Integer;
sv503_rawworkitems : Integer;
sv503_irpstacksize : Integer;
sv503_maxrawbuflen : Integer;
sv503_sessusers : Integer;
sv503_sessconns : Integer;
sv503_maxpagedmemoryusage : Integer;
sv503_maxnonpagedmemoryusage : Integer;
sv503_enablesoftcompat :BOOL;
sv503_enableforcedlogoff :BOOL;
sv503_timesource :BOOL;
sv503_acceptdownlevelapis :BOOL;
sv503_lmannounce :BOOL;
sv503_domain : PWideChar;
sv503_maxcopyreadlen : Integer;
sv503_maxcopywritelen : Integer;
sv503_minkeepsearch : Integer;
sv503_maxkeepsearch : Integer;
sv503_minkeepcomplsearch : Integer;
sv503_maxkeepcomplsearch : Integer;
sv503_threadcountadd : Integer;
sv503_numblockthreads : Integer;
sv503_scavtimeout : Integer;
sv503_minrcvqueue : Integer;
sv503_minfreeworkitems : Integer;
sv503_xactmemsize : Integer;
sv503_threadpriority : Integer;
sv503_maxmpxct : Integer;
sv503_oplockbreakwait : Integer;
sv503_oplockbreakresponsewait : Integer;
sv503_enableoplocks : BOOL;
sv503_enableoplockforceclose : BOOL;
sv503_enablefcbopens : BOOL;
sv503_enableraw : BOOL;
sv503_enablesharednetdrives : BOOL;
sv503_minfreeconnections : Integer;
sv503_maxfreeconnections : Integer;
end;
PSERVER_INFO_503 = ^SERVER_INFO_503;
function Get_Computer_Name: string;
var
dwlen: DWORD;
begin
dwlen := MAX_COMPUTERNAME_LENGTH + 1;
Setlength(Result, dwlen);
GetComputerName(pchar(Result), dwlen);
Result := StrPas(pchar(Result));
end;
function GetDomainName : string;
var
err : Integer;
buf : pointer;
fDomainName: string;
wServerName : WideString;
begin
wServerName := Get_Computer_Name;
err := NetServerGetInfo (PWideChar (wServerName), 503, buf);
if err = 0 then
try
fDomainName := PSERVER_INFO_503 (buf)^.sv503_domain;
finally
NetAPIBufferFree (buf)
end;
result := fDomainName;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Label1.Caption := GetDomainName;
end;
@luckie
Deine methode aus NetWorkInfo hab ich auch zum laufen gebracht
cya und danke
HaZe
Domenik --
Nur, weil man vor sich eine CPU hat, muß man das Denken nicht
einstellen.
|