All pastes #972345 Raw Edit

Someone

public text v1 · immutable
·published 2008-04-05 11:02 UTC
rendered paste body
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace WindowsApplication2
{
 
    public partial class Form1 : Form
    {
        public Form1()
        { 
            InitializeComponent();
        }

        [DllImport("Advapi32.dll", EntryPoint = "GetUserName", ExactSpelling = false,
                     SetLastError = true)]
        static extern bool GetUserName(string lpBuffer, ref int nSize);

        private void Form1_Load(object sender, EventArgs e)
        {
           string str ;
           int len ;
            len = 20;
            GetUserName(str, len);
            MessageBox.Show(str);
        }
    }
}



el error esta cuando llamo al getusername

Error	1	La mejor coincidencia de método sobrecargado para 'WindowsApplication2.Form1.GetUserName(string, ref int)' tiene algunos argumentos no válidos	C:\Documents and Settings\mauro\Mis documentos\Visual Studio 2005\Projects\WindowsApplication2\WindowsApplication2\Form1.cs	29	13	WindowsApplication2