Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1222 connectés 

  FORUM HardWare.fr
  Programmation
  C++

  [C Win32] Comment récupérer le nom d'utilisateur ?

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

[C Win32] Comment récupérer le nom d'utilisateur ?

n°221870
mog
KUPO !
Posté le 30-09-2002 à 16:57:38  profilanswer
 

Je voudrais connaitre la/les fonction(s) permettant de récupérer le nom de l'utilisateur actuellement logué sur un poste NT/2000.
 
Y'a un moyen ?

mood
Publicité
Posté le 30-09-2002 à 16:57:38  profilanswer
 

n°221877
antp
Super Administrateur
Champion des excuses bidons
Posté le 30-09-2002 à 17:05:08  profilanswer
 

GetUserName


---------------
mes programmes ·· les voitures dans les films ·· apprenez à écrire
n°222131
mog
KUPO !
Posté le 01-10-2002 à 08:02:30  profilanswer
 

La seule fonction GetUserName que j'ai trouvé est celle ci:
 

CDaoWorkspace::GetUserName
CString GetUserName( );
throw( CDaoException, CMemoryException );
 
Return Value
 
A CString that represents the owner of the workspace object.  
 
Remarks
 
Call this member function to obtain the name of the owner of the workspace.  
 
To get or set the permissions for the workspace owner, call DAO directly to check the Permissions property setting; this determines what permissions that user has. To work with permissions, you need a SYSTEM.MDA file.  
 
For more information about workspaces, see the articleDAO Workspace. For information about calling DAO directly, see Technical Note 54. For related information, see the topic "UserName Property" in DAO Help.
 
CDaoWorkspace Overview |  Class Members |  Hierarchy Chart
 
See Also   CDaoWorkspace::SetDefaultUser


 
Y'a pas moyen de le faire sans utiliser de MFC ?

n°222135
darkoli
Le Petit Dinosaure Bleu
Posté le 01-10-2002 à 08:54:34  profilanswer
 

Et msdn.microsoft.ocm ça sert à quoi ?
 
http://msdn.microsoft.com/library/ [...] nameex.asp
 


Platform SDK: Windows System Information
GetUserNameEx
 
 
The GetUserNameEx function retrieves the name of the user or other security principal associated with the calling thread. You can specify the format of the returned name.
 
If the thread is impersonating a client, GetUserNameEx returns the name of the client.
 
 
 
 
BOOLEAN GetUserNameEx(
  EXTENDED_NAME_FORMAT NameFormat,
  LPTSTR lpNameBuffer,
  PULONG nSize
);
 
 
Parameters
 
NameFormat
[in] Format of the name. This parameter is a value from the EXTENDED_NAME_FORMAT enumeration type. It cannot be NameUnknown.
lpNameBuffer
[out] Pointer to a buffer that receives the name in the specified format. The buffer must include space for the terminating null character.
nSize
[in, out] On input, this variable specifies the size of the lpNameBuffer buffer, in TCHARs. If the function is successful, the variable receives the number of TCHARs copied to the buffer, not including the terminating null character.  
 
If lpNameBuffer is too small, the function fails and GetLastError returns ERROR_MORE_DATA. This parameter receives the required buffer size, including the terminating null character.
 
 
 
Return Values
 
If the function succeeds, the return value is a nonzero value.
 
If the function fails, the return value is zero. To get extended error information, call GetLastError.
 
If the user name is not available in the specified format, the error is ERROR_NONE_MAPPED. If the domain controller is not available to perform the lookup, the error is ERROR_NO_SUCH_DOMAIN.
 
Requirements
 
Windows NT/2000/XP: Included in Windows 2000 and later.
Windows 95/98/Me: Unsupported.
Unicode: Implemented as Unicode and ANSI versions.
Header: Declared in Secext.h; include Security.h.
Library: Use Secur32.lib.
 
See Also
 
System Information Overview, System Information Functions, EXTENDED_NAME_FORMAT, GetUserName
 


---------------
Le site de l'année :D (XHTML 1.0 strict) : http://darkoli.free.fr/index.html
n°222139
mog
KUPO !
Posté le 01-10-2002 à 09:02:44  profilanswer
 

Desolé mais ce n'était pas dans la MSDN qu'on m'a fournis sur CD.
Je ne pense pas à utiliser la version en ligne.
 
Merci du coup de main  :hello:


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  C++

  [C Win32] Comment récupérer le nom d'utilisateur ?

 

Sujets relatifs
[Win32] [RESOLU] Recuperer la liste des processusRécuperer en ligne les donnés d'un compte mail...PLEASE HELP !
Récupérer des données sur des sites Internet et les utiliser ???[flash] un truc tout bete, recuperer la valeur d'un bouton radio
Récuperer une base MySQL dans Excel, comment faire ?[VBA - Excel] Comment recuperer le nom du fichier courent ?
Urgent Bonjour je souhaiterais récuperer les informations de l'Active.Récupérer l'adresse IP du client [Cold Fusion]
[Flash] Recuperer une variable passée dans l'URL ? 
Plus de sujets relatifs à : [C Win32] Comment récupérer le nom d'utilisateur ?


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR