WINDOWS programming gets user directory

xiaoxiao2021-03-06  19

With the management of users, the program should be handled in the user directory when writing a program to the user's management.

char lpProfileDir [255]; DWORD size = 255; memset (lpProfileDir, 0, 255); HANDLE hToken = 0; BOOL bres1 = OpenProcessToken (GetCurrentProcess (), TOKEN_ALL_ACCESS, & hToken); BOOL bres = GetUserProfileDirectory (hToken, lpProfileDir, & size) ; // get the user directory of the current process user

// GetDefaultUserProfileDirectory C: / Documents and Settings / Default User // GetAllUsersprofileDirectory C: / Documents and Settings / All Users // GetProfilesDirectory C: / Documents and Setting

转载请注明原文地址:https://www.9cbs.com/read-39889.html

New Post(0)