1 2 void __fastcall TForm1::Button1Click(TObject *Sender) 3 { 4 DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1; 5 char szBuf[MAX_COMPUTERNAME_LENGTH + 1]; 6 szBuf[0] = '\0'; 7 8 GetComputerName(szBuf, &dwSize); 9 10 Label1->Caption = szBuf; 11 }