ApplicationContext.ExitThread メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > ApplicationContext.ExitThread メソッドの意味・解説 

ApplicationContext.ExitThread メソッド

スレッドメッセージ ループ終了します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Dim instance As ApplicationContext

instance.ExitThread
public void ExitThread ()
public:
void ExitThread ()
public void ExitThread ()
解説解説

このメソッドは ExitThreadCore を呼び出します。

メモメモ

実際にスレッド終了するのは、ExitThreadExitThreadCore ではありません。これらのメソッドは、Application オブジェクト待機する ThreadExit イベント発生させます。それを受けてApplication オブジェクトスレッド終了させます

使用例使用例

ApplicationContext クラス概要から抜粋したコード例次に示します。この例では、開かれたフォーム記録取りすべてのフォーム閉じられたときに現在のスレッド終了しますOnFormClosed メソッドは、Closed イベントイベント ハンドラです。開かれたフォームの数が 0 になると、ExitThread メソッド呼び出すことによって現在のスレッド終了されます。フォームの数は、フォーム表示されときには formCount 変数の値を 1 つ増やしフォーム閉じられときには 1 つ減らすことによって追跡されます。

簡略にするため、コード一部示されていません。コード全体については、ApplicationContext参照してください

Private Sub OnFormClosed(ByVal
 sender As Object, ByVal
 e As EventArgs)
    ' When a form is closed, decrement the count of open forms.

    ' When the count gets to 0, exit the app by calling
    ' ExitThread().
    formCount = formCount - 1
    If (formCount = 0) Then
        ExitThread()
    End If
End Sub
private void OnFormClosed(object sender, EventArgs
 e) {
    // When a form is closed, decrement the count of open forms.

    // When the count gets to 0, exit the app by calling
    // ExitThread().
    formCount--;
    if (formCount == 0) {
        ExitThread();
    }
}
void OnFormClosed( Object^ /*sender*/, EventArgs^ /*e*/ )
{
   
   // When a form is closed, decrement the count of open forms.
   // When the count gets to 0, exit the app by calling
   // ExitThread().
   formCount--;
   if ( formCount == 0 )
   {
      ExitThread();
   }
}


private void OnFormClosed(Object sender, EventArgs
 e)
{
    // When a form is closed, decrement the count of open forms.
    // When the count gets to 0, exit the app by calling
    // ExitThread().
    formCount--;
    if (formCount == 0) {
        ExitThread();
    }
} //OnFormClosed
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からApplicationContext.ExitThread メソッドを検索した結果を表示しています。
Weblioに収録されているすべての辞書からApplicationContext.ExitThread メソッドを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からApplicationContext.ExitThread メソッド を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

ApplicationContext.ExitThread メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



ApplicationContext.ExitThread メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS