Try this:
[DllImport("coredll.dll", SetLastError = true)]
public static extern int GetClassName(IntPtr hWnd, StringBuilder buf, int nMaxCount);
If that doesn't work, try this:
[DllImport("user32.dll", SetLastError = true)]
public static extern int GetClassName(IntPtr hWnd, StringBuilder buf, int nMaxCount);
You many need to modify the attribute, but I'm not sure what else you would have to add. Google is your friend in that regard.
Call it like this from your main form:
StringBuilder str = new StringBuilder();
GetClassName(this, str, 1);