static void Main(string[] args) { if(args.Length != 1) { Console.Error.Write("Incorrect arguments"); Environment.Exit(1); } string hWndStr = args[0]; CloseWindow((IntPtr)int.Parse(hWndStr)); }