finding the workgroup/domain

Anyone know how to get the workgroup/domain with Delphi on a Win98/Me machine?

I have code that works for Win2K/XP but doesn't seem to work on Win98/Me.

DelphiBasicUserAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

calinutzCommented:
The workGroup you may try to obtain it using Jedi VCL components... There is a component called jvComputerInfo on jvSystem page that seems to read that for you...
I do not have a Win98 around to test it but it should work just fine
:-)
Cheers
DelphiBasicUserAuthor Commented:
It doesn't work with Win98/Me - just gives a blank return.

Was worth a try though.
David_WardCommented:
Try these, depending on operating systems you will not get BOTH of them all the time,
but, generally, one OR the other should proivide a result.

(WorkGroup)  Registry -> HKLM -> \SYSTEM\CURRENTCONTROLSET\SERVICES\VXD\VNETSUP\ -> WORKGROUP

(Domain)       Registry -> HKLM -> \SYSTEM\CURRENTCONTROLSET\SERVICES\MSNP32\NETWORKPROVIDER\ -> AUTHENTICATINGAGENT



Cheers,

David.
Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

stanley_ciaCommented:
You can use windows management instrumentation (wmi).
For win 9x you have to download wmi-Redistributional-Kit.

Find source code on how using wmi by Denis Blondeau at http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=628&lngWId=7

The code is something like this :
GetWMI_Value('Win32_ComputerSystem','NetworkServer');
GetWMI_Value('Win32_ComputerSystem','Domain');
GetWMI_Value('Win32_ComputerSystem','Workgroup');
GetWMI_Value('Win32_ComputerSystem','Username');

Stanley.
stanley_ciaCommented:
AFZDeveloperCommented:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ComCtrls;

type
  TForm1 = class(TForm)
    TV: TTreeView;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
   procedure LoadNetNode(TreeNode: TTreeNode; pNetNode: PNetResourceA);
  public
    FPCCount   : Integer;
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.LoadNetNode(TreeNode: TTreeNode; pNetNode: PNetResourceA);
var
  hEnum     : THandle;
  dwCount   : DWORD;
  dwBufSize : DWORD;
  pNR, pBuf : PNetResourceA;
  dwRet     : DWORD;
  ChildNode : TTreeNode;
begin
  dwRet := WNetOpenEnum(RESOURCE_GLOBALNET, RESOURCETYPE_ANY, 0,
                        pNetNode, hEnum);
  if dwRet <> NO_ERROR then
    Exit;
  dwBufSize := 1000;
  GetMem(pBuf, dwBufSize);
  try
    while True do
    begin
      dwCount := $FFFFFFFF; // alle Items anfordern
      dwRet := WNetEnumResource(hEnum, dwCount, pBuf, dwBufSize);
      if dwRet = ERROR_MORE_DATA then
       begin
         // der Startwert von 1000 war zu klein
         dwCount := $FFFFFFFF;
         FreeMem(pBuf);
         GetMem(pBuf, dwBufSize);
         dwRet := WNetEnumResource(hEnum, dwCount, pBuf, dwBufSize);
       end;
      if dwRet = ERROR_NO_MORE_ITEMS then
        Break; // Fertig !
      if dwRet <> NO_ERROR then
        Abort; // dwRet enthalt eine Fehlermeldung!
      pNR := pBuf;
      while dwCount > 0 do
      begin
        ChildNode := TV.Items.AddChild(TreeNode, pNR.lpRemoteName);
        LoadNetNode(ChildNode, pNR);
        Inc(pNR);
        Dec(dwCount);
        Inc(FPCCount);
      end;
    end;
  finally
    WNetCloseEnum(hEnum);
    FreeMem(pBuf);
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  FPCCount := 0;
  LoadNetNode(nil,nil);
end;

end.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DelphiBasicUserAuthor Commented:
thanks AFZDeveloper - was able to work out a few things using parts of your code
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.