Suppose you are going to call user32.dll function GetWindowText
following is the sample C# code
[System.Runtime.InteropServices.DllImport("user32.dll")]
static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount);
private void button1_Click(object sender, EventArgs e)
{
const int nMaxCount = 255;
StringBuilder str = new StringBuilder(nMaxCount);
GetWindowText(this.Handle, str, nMaxCount);
}