[英]STA thread in windowapplication
我的項目中有一些代碼,如下所示,這里STA線程的用法是什么? 我對STA的了解是單線程公寓,僅在使用COM組件時才需要。它在應用程序的主條目中使用。
/// <summary>
/// The main entry point for the application.
///
/// Command line:
/// Leaf.exe /s server-name
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.DoEvents();
Application.Run(new Leaf()); // Leaf is a constructor
}
它對其他功能沒有影響。 它僅在您的程序使用COM互操作時才有效。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.