Here is a short example that should be pretty easy to follow:
public class Win32
{
[DllImport("user32.dll")]
public static extern int FindWindow(
string lpClassName, // class name
string lpWindowName // window name
);
}
public class MyClass
{
static void Main()
{
if(0 == Win32.FindWindow(null, "MyWindowName"))
{
// the window was not found
// do stuff
}
else
{
// the window was found
// do other stuff
}
}
}
HTH,
-Cliff