Back to the WFC main page

CServer : CNetwork

$Revision: 21 $


This class allows you to gather information about a server. It can get you information similiar to the Server Control Panel applet. I am not proud of this class. It is inconsistent and ugly. I'll rewrite it one of these days.

Data Members



void Close( void )
Closes the connection with the machine and cleans up any internal buffers used.
void GetComment( CString& comment )
Retrieves the comment about the server.
void GetDomain( CString& domain_name )
Retrieves the name of the domain the server is a member of.
DWORD GetMajorVersion( void )
Retrieves the major portion of the operating system version number. For example, in NT 3.51, 3 would be the major version portion.
DWORD GetMinorVersion( void )
Retrieves the minor portion of the operating system version number. For example, in NT 3.51, 51 would be the minor version portion.
void GetName( CString& name )
Retrieves the name of the server.
DWORD GetNumberOfOpens( void )
Retrieves the number of open files/pipes on the server.
DWORD GetNumberOfUsers( void )
Retrieves the users currently using the server.
DWORD GetPlatform( void )
Tells you what kind of machine the server is.
void GetPlatformName( CString& name )
Tells you what kind of machine the server is in a human readable form.
void GetPlatformNameAndVersion( CString& name_and_platform )
An even more human friendly way of getting the server's operating system and version in a a human readable form.
DWORD GetType( void )
Retrieves type of the server.
void GetUserPath( CString& path )
Retrieves the user's path.
DWORD GetUsers( void )
Retrieves the number of users of the server.


#include <wfc.h>
#pragma hdrstop

void test_CServer( LPCTSTR machine_name )
   WFCTRACEINIT( TEXT( "test_CServer()" ) );

   CServer server;

   server.Open( machine_name );

   CString name;
   CString comment;
   CString path;
   CString os;
   CString domain;

   DWORD major_version   = 0;
   DWORD minor_version   = 0;
   DWORD type            = 0;
   DWORD users           = 0;
   DWORD number_of_users = 0;
   DWORD number_of_opens = 0;

   server.GetUserPath( path );
   server.GetName( name );
   server.GetComment( comment );
   server.GetPlatformName( os );
   server.GetDomain( domain );

   major_version   = server.GetMajorVersion();
   minor_version   = server.GetMinorVersion();
   type            = server.GetType();
   users           = server.GetUsers();
   number_of_users = server.GetNumberOfUsers();
   number_of_opens = server.GetNumberOfOpens();

   _tprintf( TEXT( "Server Name:      \"%s\"\n" ), (LPCTSTR) name    );
   _tprintf( TEXT( "Server Domain:    \"%s\"\n" ), (LPCTSTR) domain  );
   _tprintf( TEXT( "Server Comment:   \"%s\"\n" ), (LPCTSTR) comment );
   _tprintf( TEXT( "Server User Path: \"%s\"\n" ), (LPCTSTR) path    );
   _tprintf( TEXT( "Server OS:        \"%s\"\n" ), (LPCTSTR) os      );
   _tprintf( TEXT( "Server Version:    %d.%d\n" ), major_version, minor_version );
   _tprintf( TEXT( "Server Users:      %d\n" ),    users );
   _tprintf( TEXT( "Number Of Users:   %d\n" ),    number_of_users );
   _tprintf( TEXT( "Number Of Opens:   %d\n" ),    number_of_opens );

API's Used

  • NetServerGetInfo

  • Copyright, 2000, Samuel R. Blackburn
    $Workfile: cserver.cpp $
    $Modtime: 1/17/00 9:13a $