mystuff

Your IP Address is: 38.107.191.104
Last site update: 23 March 2009
You are visitor number: 

  home | wsname | wallpaper creator | delphi stuff | vb script stuff | other stuff | contact me

Google
Web Site
Here's a collection of Delphi functions I've found useful.

Network
   Using the DsGetDcName function to return the name of a domain controller in a specified domain
   Determine if the computer is a member of a Domain or Workgroup - Method 1: Using NetGetJoinInformation
   Determine if the computer is a member of a Domain or Workgroup - Method 2: Using NetRenameMachineInDomain

File System
   Determine what File System a Drive is Formatted with using GetVolumeInformation
   Get the Disk Label using GetVolumeInformation using GetVolumeInformation
   Get the Size of a File


 Determine if the computer is a member of a Domain or Workgroup - Method 2: Using NetRenameMachineInDomain

This example is a bit of a hack but seems to work ok.

Function IsInDomain: Boolean;
    type
        Type_NetRenameMachineInDomain = function (lpserver, machinename, lpaccount, passwrd : PWideChar; foptions : LongInt) : LongInt stdcall;
    var
        lngResultCode : LongInt;
        intResultCode : Integer;
        _NetRenameMachineInDomain : Type_NetRenameMachineInDomain;
    begin
        IsInDomain:=False;
        Try
            intResultCode:=LoadLibrary(pchar('netapi32.dll'));
            @_NetRenameMachineInDomain:=GetProcAddress(intResultCode,pchar('NetRenameMachineInDomain'));
            lngResultCode:= _NetRenameMachineInDomain(nil,nil,nil,nil,0);
            FreeLibrary(intResultCode);
        Finally
        end;
        if lngResultCode <> 2692 then //This machine is not currently joined to a domain
            IsInDomain:=TRUE
    end;