Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

How to get Computer name and Workgroup name?

sziszi81sziszi81 Member Posts: 80
Hi,

does anyone know how can i get the computer name and the workgroup name in a delphi program? I've searched through the registry and it's not stored there. Any idea?



Comments

  • zibadianzibadian Member Posts: 6,349
    : Hi,
    :
    : does anyone know how can i get the computer name and the workgroup name in a delphi program? I've searched through the registry and it's not stored there. Any idea?
    :
    :
    You might want to try the NetWkstaGetInfo() API function. This should return at least the computer name. The Windows SDK help files provide more info.
  • hhcamiglahhcamigla Member Posts: 31
    : : Hi,
    : :
    : : does anyone know how can i get the computer name and the workgroup name in a delphi program? I've searched through the registry and it's not stored there. Any idea?
    : :
    : :
    : You might want to try the NetWkstaGetInfo() API function. This should return at least the computer name. The Windows SDK help files provide more info.
    :

    Function ComputerName:String;
    var nSize : Cardinal;
    cRetVal: String;
    cBufPtr:PChar;
    begin
    nSize:=25;
    GetMem(cBufPtr,nSize);
    GetComputerName( cBufPtr,nSize);
    cRetVal:=cBufPtr;
    FreeMem(cBufPtr);
    Result:=cRetVal;
    end;

Sign In or Register to comment.