Здравствуйте, написал такую программу
using System;
using System.Runtime.InteropServices;
class Program
{
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string className, string windowName);
static void Main(string[] args)
{
IntPtr window = FindWindowEx(IntPtr.Zero, IntPtr.Zero, "SomeClass", null);
if (window == IntPtr.Zero)
{
Console.WriteLine("Window not found");
Console.ReadLine();
return;
}
Console.WriteLine("Window found!");
Console.ReadLine();
}
}
Если запускаю её на компьютере просто так, то получаю "Window found!", если же через телнет (telnet localhost), то "Window not found".
Почему так происходит?