On request, here's an example of how i handle my console and main statement:
Code:
[DllImport("user32.dll")]
private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll")]
private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
private static void StartForm() { Application.Run(new World()); }
public static void WriteLine(string Text) { World.WriteLine(Text); }
public static void WriteLine(Exception e) { World.WriteLine(e.ToString()); }
private static void Main(string[] args)
{
Console.Title = "Conquer New Dawn: The Returning Light";
Database.Configuration.Load();
Database.Configuration.LoadMySQL();
HideConsole();
Database.Load.All();
Handlers.Sockets.StartAuth();
Handlers.Sockets.StartGame();
WriteLine("\nThe server is ready for connections!");
}
private static void HideConsole()
{
Process window = Process.GetCurrentProcess();
window.WaitForInputIdle();
IntPtr hWnd = FindWindow(null, "Conquer New Dawn: The Returning Light");
if (hWnd != IntPtr.Zero)
ShowWindow(hWnd, 0);
Thread Start = new Thread(100);
Start.Execute += new Action(StartForm);
}