Главная страница | назад





Article #17141: Login name under 32-bit versions of

 Question and Answer Database

FAQ2141C.txt   Login name under 32-bit versions of
Category   :Windows API
Platform    :All
Product    :C++Builder  1.x

Question:
How do I get the user's login name under 32-bit versions of
Windows?

Answer:
This is easily accomplished by calling the GetUserName() Windows
API function:

void __fastcall TForm1::Button1Click(TObject *Sender)
{
    char buffer[255] = { 0 };
    unsigned long buff;
    buff = sizeof(buffer);
    GetUserName(buffer, &buff);
    ShowMessage(buffer);
}

7/2/98 10:32:32 AM
 

Last Modified: 01-SEP-99