Click here to Skip to main content
15,891,423 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hello,I have a problem about msg loop in .net winform. as we know,each ui thread at least needs one msg loop.but i have tested the code below,i thought the form "frm" would spash and disappear,but it worked well except the client area,i can use mouse to move the form,to close the form etc. now ,i have a question,since everything we do is exchanged to Msg and passed to the thread msg queue,but we need a msg loop ,the codes below don't have one,how do it work?
C#
static class Program
{
    /// <summary>
    /// The main entry point for the application.
    /// </summary>
    [STAThread]
    static void Main()
    {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        Form1 frm = new Form1();
        frm.Show();
        while(true)
        {

        }
    }
}

tell me why? my pool english,sorry for you.thanks!
Posted
Comments
Sergey Alexandrovich Kryukov 24-Dec-12 13:22pm    
This is a total abuse which however makes a great question. My 5.
—SA
amitnaik 26-Dec-12 6:04am    
I have some information but before that, what do want exactly? Do want to know, How messages are passed? or u want to track down messages which are sent?
But remember one thing UI Thread(foreground) is always different than background thread (other code which includes no UI control part).

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900