GetUserName champs vide

Résolu
VBFRANCE Messages postés 22 Date d'inscription jeudi 10 janvier 2002 Statut Membre Dernière intervention 25 juin 2008 - 13 mars 2005 à 22:10
VBFRANCE Messages postés 22 Date d'inscription jeudi 10 janvier 2002 Statut Membre Dernière intervention 25 juin 2008 - 14 mars 2005 à 01:47
J'ai un petit soucis avec la fonction

GetUserName, celle-ci me retourne une string vide, le soucis et egalement present avec la fonction GetComputerName.

Quelqu'un aurait-il un exemple a me fournir ?

Voici mon code:
.data
MsgBoxCaption1 db "User Name",0
MsgBoxCaption2 db "Computer Name",0
MsgBoxText db ?
StringLen dd ?


.code
invoke GetUserName, addr MsgBoxText,addr StringLen
invoke MessageBox, NULL, addr MsgBoxText, addr MsgBoxCaption1, MB_OK
invoke GetComputerName, addr MsgBoxText,addr StringLen
invoke MessageBox, NULL, addr MsgBoxText, addr MsgBoxCaption2, MB_OK

2 réponses

BruNews Messages postés 21040 Date d'inscription jeudi 23 janvier 2003 Statut Modérateur Dernière intervention 21 août 2019
13 mars 2005 à 22:45
MsgBoxText db ?
c'est quoi ça !?!?
On ne peut rien entrer sur 1 seul octet, c'est juste la place du zero final de la chaine.

.data
szbuff DB 40 dup(0)
nlen DD 0

.code
mov nlen, 40 ; len buffer en entree, nbr char en sortie
push offset nlen
push offset szbuff
call GetUserName

ciao...
BruNews, MVP VC++
3
VBFRANCE Messages postés 22 Date d'inscription jeudi 10 janvier 2002 Statut Membre Dernière intervention 25 juin 2008
14 mars 2005 à 01:47
merci bien pour ton aide
0
Rejoignez-nous