First, You Should Let The Application Support The Unicode. Next, I will tell you what to do in your application:
Create a project named Emuteuser of the MFC AppWizard (Exe) based Dialog.
Next, You Should Click Sections of VC, Project-> Settings, SELECT C / C Section, And in Preporcessors Definitions, Add Unicode, _unicode, Expression, This show your Application Support Unicode.
NEXT, WEHOULD SELECT LINK Section, And IN It's Projects Options, Add / Entry: "WwinMainCRTARTUP", this Tells your application's entry. In Order To Get More Information, You Should Look Up MSDN.
Now, We Have Set The Environment That Support The Unicode of The Application.
Let's Go to Subject of the Application.
In The Application, I Had Added A List Box and a Button Control.in List Box, Show The User's Name of The Enumeration Function.
Next, We Should Add Some Settings About The Application:
#include
#include
#pragma comment (Lib, "Netapi32.lib")
IF Application CAN Use NetuseRenum () ETC, We Should Add these Settings.
And we add function named emuteuser (), this function can enumerate all the users in out:
void CEmuteUserDlg :: EmuteUser () {LPUSER_INFO_0 pBuf = NULL; LPUSER_INFO_0 pTmpBuf; DWORD dwLevel = 0; DWORD dwPrefMaxLen = -1; DWORD dwEntriesRead = 0; DWORD dwTotalEntries = 0; DWORD dwResumeHandle = 0; DWORD i; DWORD dwTotalCount = 0; NET_API_STATUS nStatus;? LPTSTR pszServerName = NULL;. // The server is not the default local computer // // // Call the NetUserEnum function, specifying level 0; // enumerate global user account types only // do // begin. do {nStatus = NetUserEnum (pszServerName, dwLevel, FILTER_NORMAL_ACCOUNT, // global users (LPBYTE *) & pBuf, dwPrefMaxLen, & dwEntriesRead, & dwTotalEntries, & dwResumeHandle); //// If the call succeeds, // if ((nStatus == NERR_Success) || (NSTATUS == ERROR_MORE_DATA)) {IF ((PTMPBUF = PBUF)! = null) {/// Loop through the entries.// for (i = 0; (i
IF (PBUF! = NULL) NetapIBufferfree (PBUF);
}
But How Can We Call this function? Now, it's code:
M_Strlist.resetContent (); emuteuser ();
In settings, you can Fall Across this question: When You Compile The Application, You Can Receive The ERROR REPORT:
LINK: FATAL ERROR LNK1104: Cannot Open File "MFC42UD.LIB"
How Can We do?
OK! You Should Select Project-> Settings, in General Section, in Microsoft Foundation Classes :,
You can select Use mfc in a static library.
VC WinXP VSP5