You could create a WinForms app and hide the MainForm by Minimizing it and not showing it in the taskbar on initialization.
Form.WindowState = FormWindowState.Minimized;
Form.ShowInTaskBar = false;
Then you could run whatever code you wanted within the message loop for MainForm w/out any UI. If at some point you wanted a user interface you could show main form or any other number of forms.
public partial class Form1 : Form
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
public Form1()
{
InitializeComponent();
this.WindowState = FormWindowState.Minimized;
this.ShowInTaskbar = false;
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
MessageBox.Show("Loaded");
}
}
Or, you could possibily just launch your console program as a hidden window and use a pinvoke as described in the following post...
http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/ffe733a5-6c30-4381-a41f-11fd4eff9133/
class Program
{
const int Hide = 0;
const int Show = 1;
[DllImport("Kernel32.dll")]
private static extern IntPtr GetConsoleWindow();
[DllImport("User32.dll")]
private static extern bool ShowWindow(IntPtr hWnd, int cmdShow);
static void Main(string[] args)
{
Console.WriteLine("Press any key to hide me.");
Console.ReadKey();
IntPtr hWndConsole = GetConsoleWindow();
if (hWndConsole != IntPtr.Zero)
{
ShowWindow(hWndConsole, Hide);
System.Threading.Thread.Sleep(5000);
ShowWindow(hWndConsole, Show);
}
Console.ReadKey();
}
}