2010-01-29 4 views

Répondre

8

Je pense que vous aurez besoin de se plonger dans les appels API FindWindow et ShowWindow. Par exemple:

[DllImport("user32.dll")] 
    public static extern IntPtr FindWindow(string lpClassName, string lpWindowName); 


    [DllImport("user32.dll")] 
    public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); 

    static void Main(string[] args) 
    { 
     Console.Title = "ConsoleApplication1"; 

     IntPtr h=FindWindow(null, "ConsoleApplication1"); 

     ShowWindow(h, 0); // 0 = hide 

     Form f = new Form(); 

     f.ShowDialog(); 

     ShowWindow(h, 1); // 1 = show 

    } 
+0

Merci :) méthode très intéressante – Cynede

+0

heureux de vous aider. Bien sûr, cela fait ressembler une application Windows Forms normale, donc vous êtes probablement le meilleur en utilisant Windows Forms à moins que vous ayez vraiment besoin de la fenêtre de la console. – Ash

+0

Win App est buggé sur la construction actuelle de Nemerle> _ < – Cynede