The Net* family of APIs do the job.
The documented version of them is available from Win2000 Professional and above (Netapi32.dll).The
(undocumented) Net* family of APIs for Win95/98 are burried inside
RADMIN32.DLL and RLOCAL32.DLL.
Here are some links to get you started:Torry's Delphi PagesThis one here is in Delphi, but only uses Win32API, so it won't be too hard to follow up...
It's a cross-platform example of how to determine the user's logon domain (Win9x & NT).Win32 samplesLook at the Network section (on the left pane) for some examples (C++).Finally, since these APIs are the predecessors of the Net* APIs, you can gather useful information about them (purpose, arguments etc) from their Netapi32.dll successors, on
MSDN.
In other words, what you will need to do, is to create import libraries for RADMIN32.DLL and RLOCAL32.DLL, figure out what functions you'll need to use, and find the prototypes/arguments for those APIs (... and use them).