Witam,
Mam do napisania kod, ktory wyswietla nazwe uzytkowniaka, znalazlem jak powinna wygladac funkcja GetUserName ale nie czemu nie moge uzyc string jako pierwszy argument jak tak zrobie to wyswietla(wyswietlanie przez MessageBox) mi sie pusty napis.
[DllImport("User32.dll")]
public static extern int MessageBox(int owner, string text, string tittle, int type);
//type - zawiera flagi, które określają wygląd i zachowanie się okna dialogowego
[DllImport("advapi32.dll", SetLastError = true)]
static extern bool GetUserName(string username, ref Int32 length);
static int Main()
{
string Buffer="";
int nSize = 257;
GetUserName(Buffer, ref nSize);
return MessageBox(0, Buffer.ToString(), "Username", 0);
}