Click here to Skip to main content
Click here to Skip to main content

A set of Network Management Classes

, 21 Jan 2002
Rate this:
Please Sign up or sign in to vote.
A set of classes that make it easy to work with Network Management.

Overview

I created these classes to make it easy to work with Network Management. For this I created the CNetDomain class, the CNetUsers class, The CNetGroups class and the CNetLocalGroups class.

The CNetDomain Class

CNetDomain::CNetDomain

Construct a CNetDomain object.

CNetDomain();
CNetDomain(CString strDomainName);

Parameters

CString strDomainName a string that contains the Domain name. If this parameter is empty, the domain where the machine is logued, is used.

Remarks:

If you use the first construct, the CNetDomain class will work only with the machine that it is running, getting and updating the information on it

For Example:

CNetDomain pDomain(_T(""));            //This sample use the domain where 
is logued the Machine...
CNetDomain pDomain(_T("Developers"));  //This sample use the Developers 
domain...
CNetDomain pDomain();                  //This sample use the local 
machine...

CNetDomain::SetDomainName

SetDomainName set the domain name in the CNetDomain object.

void SetDomainName(CString strDomainName);

Parameters

CString strDomainName a string that contains the Domain name.


CNetDomain::GetDomainName

The GetDomainName function returns the domain name in the CNetDomain object.

CString GetDomainName();

CNetDomain::GetPDC

The GetPDC function returns the name of the Primary Domain Controller (PDC).

DWORD GetPDC(CString& strPDC);

Parameters

CString& strPDC a buffer receives the server name of the Primary Domain Controller (PDC) of the domain.

Return Value

Returns 0 if was successfully.


CNetDomain::m_strError

Remarks:

The m_strError data member Contains the last error string.


The CNetUsers Class


CNetUsers::CNetUsers

The CNetUsers .

CNetUsers();
CNetUsers(CNetDomain pDomain);

Parameters

CNetDomain pDomain


CNetUsers::Add

The Add function Adds a user.

DWORD Add(CString strUser, CString strPassword);

Parameters

CString strUser A string containing the User Name to add.

CString strPassword A string containing the User Password.

Return Value

The function returns 0 if was succesfully.

See Sample


<A name=Sample01>
CNetDomain pDomain(_T(""));

CNetUsers pUsers(pDomain);

if(pUsers.Add("TestUser", "Newpass") == 0)
{
	pUsers.DisableUser(FALSE);

	BOOL bRet;

	pUsers.IsUserDisable(bRet);

	if(bRet)
		AfxMessageBox("The user is Disable");
	else
		AfxMessageBox("The user is Enable");
}
</A>

CNetUsers::Delete

The Delete function deletes a user.

DWORD Delete(CString strUserName);

Parameters

CString strUserName A string specifying the name of the user account.

Return Value

The function returns 0 if was succesfully.


CNetUsers::SetUser

The SetUser function set a user in the CNetUsers objects.

void SetUser(CString strUserName);

Parameters

CString strUserName A string specifying the name of the user account.


CNetUsers::GetUser

The GetUser function returns the user name in the CNetUsers objects.

CString GetUser();

Return Value

The function returns a string with the user name.


CNetUsers::SetPassword

The SetPassword function sets the user password.

DWORD SetPassword(CString strUserName, CString strPassword);
DWORD SetPassword(CString strPassword);

Parameters

CString strUserName A string specifying the name of the user account.

CString strPassword A string containing the User Password.

Return Value

The function returns 0 if was succesfully.


CNetUsers::ChangePassword

The ChangePassword function changes the user password.

DWORD ChangePassword(CString strUserName, CString strOldPassword, CString 
strNewPassword);
DWORD ChangePassword(CString strOldPassword, CString strNewPassword);

Parameters

CString strUserName A string specifying the name of the user account.

CString strOldPassword A string containing the old User Password.

CString strNewPassword A string containing the new User Password.

Return Value

The function returns 0 if was succesfully.


CNetUsers::ForceChangePassword

The ForceChangePassword function forces to the user to change the password in the next logon.

DWORD ForceChangePassword(CString strUserName, BOOL bChangePass = TRUE);
DWORD ForceChangePassword(BOOL bChangePass = TRUE);

Parameters

CString strUserName A string specifying the name of the user account.

BOOL bChangePass A pointer to set the change of password.

Return Value

The function returns 0 if was succesfully.


CNetUsers::IsForcedChangePassword

The IsForcedChangePassword function returns if the user must to change the password in the next logon.

DWORD IsForcedChangePassword(CString strUserName, BOOL& bChangePass);
DWORD IsForcedChangePassword(BOOL& bChangePass);

Parameters

CString strUserName A string specifying the name of the user account.

BOOL& bChangePass A reference to a variable that returns if the user must to change the password.

Return Value

The function returns 0 if was succesfully.


CNetUsers::DisableUser

The DisableUser function disables the user.

DWORD DisableUser(CString strUserName, BOOL bDisable = TRUE);
DWORD DisableUser(BOOL bDisable = TRUE);

Parameters

CString strUserName A string specifying the name of the user account.

BOOL bDisable A pointer to Disable the user.

Return Value

The function returns 0 if was succesfully.

See Sample


CNetUsers::GetUserInfo

The GetUserInfo function gets info about the user.

DWORD GetUserInfo(CString strUserName, CNetUserInfo* pUserInfo);
DWORD GetUserInfo(CNetUserInfo* pUserInfo);

Parameters

CString strUserName A string specifying the name of the user account.

CNetUserInfo* pUserInfo A pointer to a CNetUserInfo object.

struct CNetUserInfo
{
	LPSTR	name;
	LPSTR	password;
	DWORD	password_age;
	DWORD	priv;
	LPSTR	home_dir;
	LPSTR	comment;
	DWORD	flags;
	LPSTR	script_path;
	DWORD	auth_flags;
	LPSTR	full_name;
	LPSTR	usr_comment;
	LPSTR	parms;
	LPSTR	workstations;
	DWORD	last_logon;
	DWORD	last_logoff;
	DWORD	acct_expires;
	DWORD	max_storage;
	DWORD	units_per_week;
	PBYTE	logon_hours;
	DWORD	bad_pw_count;
	DWORD	num_logons;
	LPSTR	logon_server;
	DWORD	country_code;
	DWORD	code_page;
	DWORD	user_id;
	DWORD	primary_group_id;
	LPSTR	profile;
	LPSTR	home_dir_drive;
	BOOL	password_expired;
};

For Example:

CNetUserInfo pUserInfo;
pUsers.GetUserInfo("Administrator", &pUserInfo);

Return Value

The function returns 0 if was succesfully.


CNetUsers::SetFullName

The SetFullName function sets the User Full Name.

DWORD SetFullName(CString strUserName, CString strFullName);
DWORD SetFullName(CString strFullName);

Parameters

CString strUserName A string specifying the name of the user account.

CString strFullName A string containing the User Full Name.

Return Value

The function returns 0 if was succesfully.


CNetUsers::GetFullName

The GetFullName function gets the User Full Name.

DWORD GetFullName(CString strUserName, CString& strFullName);
DWORD GetFullName(CString& strFullName);

Parameters

CString strUserName A string specifying the name of the user account.

CString& strFullName A reference to a string that returns the User Full Name.

Return Value

The function returns 0 if was succesfully.


CNetUsers::SetComment

The SetComment function sets the user comment.

DWORD SetComment(CString strUserName, CString strComment);
DWORD SetComment(CString strComment);

Parameters

CString strUserName A string specifying the name of the user account.

CString strComment A string containing the User Comment.

Return Value

The function returns 0 if was succesfully.


CNetUsers::GetComment

The GetComment function gets the user comment.

DWORD GetComment(CString strUserName, CString& strComment);
DWORD GetComment(CString& strComment);

Parameters

CString strUserName A string specifying the name of the user account.

CString strComment A reference to string that returns the User Comment.

Return Value

The function returns 0 if was succesfully.


CNetUsers::SetHomeDirectory

The SetHomeDirectory function sets the user Home Directory.

DWORD SetHomeDirectory(CString strUserName, CString strHomeDirectory);
DWORD SetHomeDirectory(CString strHomeDirectory);

Parameters

CString strUserName A string specifying the name of the user account.

CString strHomeDirectory A string containing the User Home Directory.

Return Value

The function returns 0 if was succesfully.


CNetUsers::GetHomeDirectory

The GetHomeDirectory function gets the user Home Directory.

DWORD GetHomeDirectory(CString strUserName, CString& strHomeDirectory);
DWORD GetHomeDirectory(CString& strHomeDirectory);

Parameters

CString strUserName A string specifying the name of the user account.

CString& strHomeDirectory A reference to a string that returns the User Home Directory.

Return Value

The function returns 0 if was succesfully.


CNetUsers::SetHomeDirDrive

The SetHomeDirDrive function sets the drive letter to assign to the user's home directory for logon purposes.

DWORD SetHomeDirDrive(CString strUserName, CString strHomeDirDrive);
DWORD SetHomeDirDrive(CString strHomeDirDrive);

Parameters

CString strUserName A string specifying the name of the user account.

CString strHomeDirDrive A string containing the Drive letter.

Return Value

The function returns 0 if was succesfully.


CNetUsers::GetHomeDirDrive

The GetHomeDirDrive function gets the drive letter assigned to the user's home directory for logon purposes.

DWORD GetHomeDirDrive(CString strUserName, CString& strHomeDirectory);
DWORD GetHomeDirDrive(CString& strHomeDirectory);

Parameters

CString strUserName A string specifying the name of the user account.

CString& strHomeDirDrive A string containing the Drive letter.

Return Value

The function returns 0 if was succesfully.


CNetUsers::SetUserPrivilege

The SetUserPrivilege function sets the user Privilege.

DWORD SetUserPrivilege(CString strUserName, int nPrivilege);
DWORD SetUserPrivilege(int nPrivilege);

Parameters

CString strUserName A string specifying the name of the user account.

int nPrivilege can be one of the following values:

    CNetUsers::usrPrivGuest   Guest
    CNetUsers::usrPrivUser     User
    CNetUsers::usrPrivAdmin   Administrator

Return Value

The function returns 0 if was succesfully.


CNetUsers::GetUserPrivilege

The GetUserPrivilege function gets the user Privilege.

DWORD GetUserPrivilege(CString strUserName, int& nPrivilege);
DWORD GetUserPrivilege(int& nPrivilege);

Parameters

CString strUserName A string specifying the name of the user account.

int& nPrivilege A numeric reference that returns the User Privilege. See SetUserPrivilege

Return Value

The function returns 0 if was succesfully.


CNetUsers::SetOperatorPrivilege

The SetOperatorPrivilege function specifies the user's operator privileges assigned to a user network account.

DWORD SetOperatorPrivilege(CString strUserName, int nPrivileges);
DWORD SetOperatorPrivilege(int nPrivileges);

Parameters

CString strUserName A string specifying the name of the user account.

int nPrivileges a set of bit flags defining the operator privileges assigned to a user network account.

    CNetUers::opPrivPrint        The print operator privilege is enabled.
    CNetUers::opPrivComm     The communications operator privilege is enabled.
    CNetUers::opPrivServer     The server operator privilege is enabled.
    CNetUers::opPrivAccounts  The accounts operator privilege is enabled.


CNetUsers::GetOperatorPrivilege

The GetOperatorPrivilege function retrieves the user's operator privileges assigned to a user network account.

DWORD GetOperatorPrivilege(CString strUserName, int& nPrivileges);
DWORD GetOperatorPrivilege(int& nPrivileges);

Parameters

CString strUserName A string specifying the name of the user account.

int& nPrivileges a numeric reference that returns a set of bit flags defining the operator privileges assigned to a user network account.


Return Value

The function returns 0 if was succesfully.


CNetUsers::SetNotChangePass

The SetNotChangePass function sets if the user can change the password.

DWORD SetNotChangePass(CString strUserName, BOOL bPermit = FALSE);
DWORD SetNotChangePass(BOOL bPermit = FALSE);

Parameters

CString strUserName A string specifying the name of the user account.

BOOL bPermit A boolean that determines if the user can change the password.

Return Value

The function returns 0 if was succesfully.


CNetUsers::GetNotChangePass

The GetNotChangePass function gets if the user can change the password.

DWORD GetNotChangePass(CString strUserName, BOOL& bNotPermit);
DWORD GetNotChangePass(BOOL& bNotPermit);

Parameters

CString strUserName A string specifying the name of the user account.

BOOL& bNotPermit A boolean reference that determines if the user can change the password.

Return Value

The function returns 0 if was succesfully.


CNetUsers::SetWorkStations

The SetWorkStations function specifies the names of workstations from which the user can log on.

DWORD SetWorkStations(CString strUserName, CString strWorkStations);
DWORD SetWorkStations(CString strWorkStations);

Parameters

CString strUserName A string specifying the name of the user account.

CString strWorkStations A string that contains the names of workstations from which the user can log on.

As many as eight workstations can be specified; the names must be separated by commas. An empty string indicates that there is no restriction.

For Example:

	pUsers.SetWorkStations("pc1,pc2,pc3");
	pUsers.SetWorkStations("");

Return Value

The function returns 0 if was succesfully.


CNetUsers::GetWorkStations

The GetWorkStations function gets the names of workstations from which the user can log on.

DWORD GetWorkStations(CString strUserName, CString& strWorkStations);
DWORD GetWorkStations(CString& strWorkStations);

Parameters

CString strUserName A string specifying the name of the user account.

CString& strWorkStations A reference to a string that contains the names of workstations from which the user can log on.

Return Value

The function returns 0 if was succesfully.


CNetUsers::GetBadPasswordCount

The GetBadPasswordCount function returns the number of times the user tried to log on to this account using an incorrect password.

DWORD GetBadPasswordCount(CString strUserName, long& nCount);
DWORD GetBadPasswordCount(long& nCount);

Parameters

CString strUserName A string specifying the name of the user account.

long& nCount a reference to a long value that indicates the number of times the user tried to log on.

Return Value

The function returns 0 if was succesfully.


CNetUsers::GetLogonCount

The GetLogonCount function returns the number of times the user has logged on successfully to this account.

DWORD GetLogonCount(CString strUserName, long& nCount);
DWORD GetLogonCount(long& nCount);

Parameters

CString strUserName A string specifying the name of the user account.

long& nCount a reference to a long value that indicates the number of times the user has logged on successfully.

Return Value

The function returns 0 if was succesfully.


CNetUsers::GetPasswordAge

The GetPasswordAge function returns the number of seconds that have elapsed since the user password was last changed.

DWORD GetPasswordAge(CString strUserName, DWORD& nSeconds);
DWORD GetPasswordAge(DWORD& nSeconds);

Parameters

CString strUserName A string specifying the name of the user account.

DWORD& nSeconds a reference to a DWORD value that indicates the number of seconds that have elapsed.

Return Value

The function returns 0 if was succesfully.


CNetUsers::IsUserDisable

The IsUserDisable function returns if the user account is disabled.

DWORD IsUserDisable(CString strUserName, BOOL& bDisable);
DWORD IsUserDisable(BOOL& bDisable);

Parameters

CString strUserName A string specifying the name of the user account.

BOOL& bDisable a reference to a BOOL value that indicates if the user account is disabled..

Return Value

The function returns 0 if was succesfully.

See Sample


CNetUsers::QueryFirstUser

The QueryFirstUser function returns user account information.

DWORD QueryFirstUser(CString& strUserName, BOOL& bMoreData);

Parameters

CString& strUserName a reference to a string that returns the name of the user account.

BOOL& bMoreData a reference to a BOOL value that indicates if has more data to get.

Return Value

The function returns 0 if was succesfully.


CNetUsers::QueryNextUser

The QueryNextUser function returns user account information.

DWORD QueryNextUser(CString& strUserName, BOOL& bMoreData);

Parameters

CString& strUserName a reference to a string that returns the name of the user account.

BOOL& bMoreData a reference to a BOOL value that indicates if has more data to get.

Return Value

The function returns 0 if was succesfully.


CNetUsers::FindFirstUser

The FindFirstUser function provides information about all user accounts on a server.

DWORD FindFirstUser(CString& strUserName, BOOL& bMoreData);
DWORD FindFirstUser(BOOL& bMoreData);

Parameters

CString& strUserName a reference to a string that returns the name of the user account.

BOOL& bMoreData a reference to a BOOL value that indicates if has more data to get.

Return Value

The function returns 0 if was succesfully.

See Sample


CNetUsers::FindNextUser

The FindNextUser function provides information about all user accounts on a server.

DWORD FindNextUser(CString& strUserName, BOOL& bMoreData);
DWORD FindNextUser(BOOL& bMoreData);

Parameters

CString& strUserName a reference to a string that returns the name of the user account.

BOOL& bMoreData a reference to a BOOL value that indicates if have more data to get.

Return Value

The function returns 0 if was succesfully.

See Sample


<A name=FindUser&GroupSample>
CNetDomain pDomain(_T(""));

CNetUsers pUsers(pDomain);
CNetGroups pGroups(pDomain);

CString str;
BOOL bMore;

pUsers.FindFirstUser(str, bMore);
while(bMore)
{
	.
	.
	pUsers.FindNextUser(str, bMore);
}

pGroups.FindFirstGroup(str, bMore);
while(bMore)
{
	.
	.
	pGroups.FindNextGroup(str, bMore);
}
</A>

CNetUsers::m_strError

Remarks:

The m_strError data member Contains the last error string.



The CNetGroups Class


CNetGroups::CNetGroups

The CNetGroups .

CNetGroups(CNetDomain pDomain);
CNetGroups();

Parameters

CNetDomain pDomain


CNetGroups::GetGroup

The GetGroup function returns the global group name in the CNetGroups objects.

CString GetGroup();

Return Value

The function returns a string with the global group name.


CNetGroups::Add

The Add function creates a global group in the security database.

DWORD Add(CString strGroupName, CString strComments = _T(""));

Parameters

CString strGroupName A string specifying the name of the global group to add.

CString strComments a string specifying a comment associated with the global group.

Return Value

The function returns 0 if was succesfully.


CNetGroups::AddUser

The AddUser function adds membership of one existing user accounts to an existing global group.

DWORD AddUser(CString strGroupName, CString strUserName);
DWORD AddUser(CString strUserName);

Parameters

CString strGroupName A string specifying the name of the global group.

CString strUserName a string specifying the name of the user to be given membership in the global group.

Return Value

The function returns 0 if was succesfully.


CNetGroups::DeleteUser

The DeleteUser function removes a user from a particular global group in the security database.

DWORD DeleteUser(CString strGroupName, CString strUserName);
DWORD DeleteUser(CString strUserName);

Parameters

CString strGroupName A string specifying the name of the global group.

CString strUserName a string specifying the name of the user to remove from the global group.

Return Value

The function returns 0 if was succesfully.


CNetGroups::Delete

The Delete function removes a global group from the security database.

DWORD Delete();
DWORD Delete(CString strGroupName);

Parameters

CString strGroupName A string specifying the name of the global group to remove.

Return Value

The function returns 0 if was succesfully.


CNetGroups::FindFirstGroup

The FindFirstGroup function retrieves information about each global group in the security database.

DWORD FindFirstGroup(CString& strGroupName, BOOL& bMoreData);
DWORD FindFirstGroup(BOOL& bMoreData);

Parameters

CString& strGroupName A reference to a string specifying the name of the global group that was founded.

BOOL& bMoreData a reference to a BOOL value that indicates if has more data to get.

Return Value

The function returns 0 if was succesfully.

See Sample


CNetGroups::FindNextGroup

The FindNextGroup function retrieves information about each global group in the security database.

DWORD FindNextGroup(CString& strGroupName, BOOL& bMoreData);
DWORD FindNextGroup(BOOL& bMoreData);

Parameters

CString& strGroupName A reference to a string specifying the name of the global group that was founded.

BOOL& bMoreData a reference to a BOOL value that indicates if has more data to get.

Return Value

The function returns 0 if was succesfully.


CNetGroups::FindFirstUser

The FindFirstUser function retrieves information about each user in a global group account.

DWORD FindFirstUser(CString strGroupName, CString& strUserName, BOOL& 
bMoreData);
DWORD FindFirstUser(CString& strUserName, BOOL& bMoreData);

Parameters

CString strGroupName A string specifying the name of the global group where look for.

CString& strUserName A reference to a string returns the user name.

BOOL& bMoreData a reference to a BOOL value that indicates if has more data to get.

Return Value

The function returns 0 if was succesfully.


CNetGroups::FindNextUser

The FindNextUser function retrieves information about each user in a global group account.

DWORD FindNextUser(CString& strUserName, BOOL& bMoreData);

Parameters

CString& strUserName A reference to a string returns the user name.

BOOL& bMoreData a reference to a BOOL value that indicates if has more data to get.

Return Value

The function returns 0 if was succesfully.


CNetGroups::SetGroup

The SetGroup sets a current global group account.

void SetGroup(CString strGroupName);

Parameters

CString strGroupName A string specifying the name of the global group account.


CNetGroups::GetGroup

The GetGroup returns the name of the current global group account.

CString GetGroup();

Return Value

The function returns the global group account name.


CNetGroups::m_strError

Remarks:

The m_strError data member Contains the last error string.


The CNetLocalGroups Class


CNetLocalGroups::CNetLocalGroups

The CNetLocalGroups .

CNetLocalGroups(CNetDomain pDomain);
CNetLocalGroups();

Parameters

CNetDomain pDomain


CNetLocalGroups::GetGroup

The GetGroup function returns the local group name in the CNetLocalGroups objects.

CString GetGroup();

Return Value

The function returns a string with the local group name.


CNetLocalGroups::Add

The Add function creates a local group in the security database.

DWORD Add(CString strLocalGroupName, CString strComments = _T(""));

Parameters

CString strLocalGroupName A string specifying the name of the local group to add.

CString strComments a string specifying a comment associated with the local group.

Return Value

The function returns 0 if was succesfully.


CNetLocalGroups::AddUser

The AddUser function adds membership of one existing user accounts to an existing local group.

DWORD AddUser(CString strLocalGroupName, CString strUserName);
DWORD AddUser(CString strUserName);

Parameters

CString strLocalGroupName A string specifying the name of the local group to add.

CString strUserName a string specifying the name of the user to be given membership in the local group.

Return Value

The function returns 0 if was succesfully.


CNetLocalGroups::DeleteUser

The DeleteUser function removes a user from a local group.

DWORD DeleteUser(CString strLocalGroupName, CString strUserName);
DWORD DeleteUser(CString strUserName);

Parameters

CString strLocalGroupName A string specifying the name of the local group.

CString strUserName a string specifying the name of the user to remove from the local group.

Return Value

The function returns 0 if was succesfully.


CNetLocalGroups::Delete

The Delete function removes a local group from the security database.

DWORD Delete();
DWORD Delete(CString strLocalGroupName);

Parameters

CString strLocalGroupName A string specifying the name of the local group to remove.

Return Value

The function returns 0 if was succesfully.


CNetLocalGroups::FindFirstGroup

The FindFirstGroup function retrieves information about each local group in the security database.

DWORD FindFirstGroup(CString& strLocalGroupName, BOOL& bMoreData);
DWORD FindFirstGroup(BOOL& bMoreData);

Parameters

CString strLocalGroupName A string specifying the name of the local group that was founded.

BOOL& bMoreData a reference to a BOOL value that indicates if has more data to get.

Return Value

The function returns 0 if was succesfully.


CNetLocalGroups::FindNextGroup

The FindNextGroup function retrieves information about each local group in the security database.

DWORD FindNextGroup(CString& strLocalGroupName, BOOL& bMoreData);
DWORD FindNextGroup(BOOL& bMoreData);

Parameters

CString strLocalGroupName A string specifying the name of the local group that was founded.

BOOL& bMoreData a reference to a BOOL value that indicates if has more data to get.

Return Value

The function returns 0 if was succesfully.


CNetLocalGroups::FindFirstUser

The FindFirstUser function retrieves information about each user in a local group account.

DWORD FindFirstUser(CString strLocalGroupName, CString& strUserName, BOOL& 
bMoreData);
DWORD FindFirstUser(CString& strUserName, BOOL& bMoreData);

Parameters

CString strLocalGroupName A string specifying the name of the local group prefixed by the domain name and the "\" separator character. For Example: DEVELOPER\Administrator

CString& strUserName A reference to a string returns the user name.

BOOL& bMoreData a reference to a BOOL value that indicates if has more data to get.

Return Value

The function returns 0 if was succesfully.


CNetLocalGroups::FindNextUser

The FindNextUser function retrieves information about each user in a local group account.

DWORD FindNextUser(CString& strUserName, BOOL& bMoreData);

Parameters

CString& strUserName A reference to a string returns the user name prefixed by the domain name and the "\" separator character.

BOOL& bMoreData a reference to a BOOL value that indicates if has more data to get.

Return Value

The function returns 0 if was succesfully.


CNetLocalGroups::SetGroup

The SetGroup sets a local group account.

void SetGroup(CString strLocalGroupName);

Parameters

CString strLocalGroupName A string specifying the name of the local group.


CNetLocalGroups::GetGroup

The GetGroup returns the name of the current local group account.

CString GetGroup();

Return Value

The function returns the local group account name.


CNetLocalGroups::m_strError

Remarks:

The m_strError data member Contains the last error string.



Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Unsupported.
  Library: Use Netapi32.lib.

Carlos A. Antollini.

Updates

28 Nov 2001    Version 1.0 Released.

03 Dec 2001    Version 1.08

  • Added the following functions:
    CNetGroups::FindFirstUser, CNetGroups::FindNextUser, CNetLocalGroups::FindFirstUser, CNetLocalGroups::FindNextUser

16 Jan 2002    Version 1.10

  • Added the following functions:
    CNetUsers::GetHomeDirDrive, CNetUsers::SetHomeDirDrive

Special thanks

These Net Classes received many suggestions from the users.
Thank to All for your collaboration and Ideas.

Ingo Stapel
Spiros Prantalos

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Carlos Antollini
Architect Citigroup
Argentina Argentina
Carlos Antollini is a software engineer working on Object Oriented, Visual C++, MFC, COM, ATL, ADO, Internet technologies and Business Intelligence.
Carlos is originally from Argentina, he was living for several years in Fort Lauderdale, Florida, working for Citibank. Then he started his own business.
Carlos is the creator of piFive[^], a family of BI Analytic Platform software, that it deals next to, latinsys[^], his partner in businesses...
Currently he is sharing his passion for project management and BI at Citigroup.

Comments and Discussions

 
GeneralMy vote of 5 Pinmemberwuditanke25-Nov-11 22:57 
Questioncurrently logged on user is domain admin or not Pinmembersanjay kaledhonkar20-Jul-07 1:17 
GeneralSoy Argentino! Carlos AYUDA! Pinmembersebastianos5-Aug-05 12:44 
Generalunlock users Pinmembersebastianos5-Aug-05 4:56 
QuestionHow can I get workstations names where user is current logged in?? Pinmemberherbert.fischer@gmail.com31-Aug-04 5:13 
Generalcomputer is on domain or workgroup Pinmemberkamranwali22-Jan-04 5:21 
GeneralCompile error Pinmemberschwgh16-Nov-03 21:26 
GeneralRe: Compile error PinmemberCarlos Antollini17-Nov-03 9:52 
GeneralDE ARGENTINA! AYUDAAAAAA Pinmembersebastianos5-Aug-05 12:46 
QuestionWorkstation(machine) name ?? PinmemberThomasBoseKenn31-Mar-03 22:16 
AnswerHow get Workstation(machine) name ?? PinmemberXHungChung22-Oct-06 18:06 
GeneralPassword PinmemberCaracarn16-Mar-03 22:04 
GeneralCurrent Users Pinmembercristicristea30-May-02 3:09 
GeneralRe: Current Users PinmemberThatsAlok29-Dec-04 19:36 
QuestionLinking Error? PinmemberAsif Bhimla20-May-02 22:14 
AnswerRe: Linking Error? Pinmembercristitomi26-Feb-07 23:16 
Generaluserlist PinmemberHaresh15-May-02 1:21 
GeneralI cannot get the workstation name.. PinmemberNeilDevlin14-May-02 11:19 
GeneralRe: I cannot get the workstation name.. PinmemberCarlos Antollini14-May-02 11:21 
GeneralRe: I cannot get the workstation name.. PinmemberNeilDevlin14-May-02 20:48 
GeneralRe: I cannot get the workstation name.. PinmemberXHungChung22-Oct-06 18:17 
GeneralCompile Error PinmemberCsm7-May-02 23:48 
during the compilation the following error appears:
 
Net.obj : error LNK2001: unresolved external symbol _NetApiBufferFree@4
Net.obj : error LNK2001: unresolved external symbol _NetGetDCName@12
 
In what does the problem consist?
GeneralRe: Compile Error PinmemberCarlos Antollini8-May-02 4:16 
GeneralRe: Compile Error PinmemberXHungChung22-Oct-06 17:35 
GeneralRe: Compile Error Pinmembercristitomi26-Feb-07 23:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web04 | 2.8.140821.2 | Last Updated 22 Jan 2002
Article Copyright 2001 by Carlos Antollini
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid