SystemEventsとは? わかりやすく解説

SystemEvents イベント


パブリック イベントパブリック イベント

  名前 説明
パブリック イベント DisplaySettingsChanged ユーザー表示設定変更する発生します
パブリック イベント DisplaySettingsChanging 表示設定変更されているときに発生します
パブリック イベント EventsThreadShutdown システム イベント待機するスレッド終了する前に発生します
パブリック イベント InstalledFontsChanged ユーザーシステム フォント追加するか、またはシステム フォント削除する発生します
パブリック イベント LowMemory システム使用可能な RAM不足する発生します
パブリック イベント PaletteChanged ユーザーが、別のパレット使用するアプリケーション切り替える発生します
パブリック イベント PowerModeChanged ユーザーシステム中断または再開する発生します
パブリック イベント SessionEnded ユーザーシステムからログオフするか、システムシャットダウンすると発生します
パブリック イベント SessionEnding ユーザーシステムからログオフようとした場合、またはシステムシャットダウンようとした場合発生します
パブリック イベント SessionSwitch 現在ログインしているユーザー変更され場合発生します
パブリック イベント TimeChanged ユーザーシステム時間変更する発生します
パブリック イベント TimerElapsed ウィンドウ タイマ間隔経過したときに発生します
パブリック イベント UserPreferenceChanged ユーザー設定変更される発生します
パブリック イベント UserPreferenceChanging ユーザー設定変更しているときに発生します
参照参照

関連項目

SystemEvents クラス
Microsoft.Win32 名前空間
PowerModeChangedEventHandler デリゲート
SessionEndedEventHandler デリゲート
SessionEndingEventHandler デリゲート
SessionSwitchEventHandler デリゲート
TimerElapsedEventHandler
UserPreferenceChangedEventHandler
UserPreferenceChangingEventHandler

SystemEvents クラス

システム イベント通知へのアクセス提供します。このクラス継承できません。

名前空間: Microsoft.Win32
アセンブリ: System (system.dll 内)
構文構文

Public NotInheritable Class
 SystemEvents
public sealed class SystemEvents
public ref class SystemEvents sealed
public final class SystemEvents
public final class SystemEvents
解説解説
使用例使用例

システム イベント対象登録してイベントの発生待機するコード例次に示します。ここに示す出力は、ユーザーディスプレイ解像度変更した場合発生します

Imports System
Imports Microsoft.Win32
Imports System.Windows.Forms

Friend Class Form1
    Inherits System.Windows.Forms.Form


    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Set the SystemEvents class to receive event notification 
        'when a user preference changes, the palette changes, or 
        'when display settings change.
        AddHandler SystemEvents.UserPreferenceChanging, _
        AddressOf SystemEvents_UserPreferenceChanging

        AddHandler SystemEvents.PaletteChanged, _
        AddressOf SystemEvents_PaletteChanged

        AddHandler SystemEvents.DisplaySettingsChanged, _
        AddressOf SystemEvents_DisplaySettingsChanged

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides
 Sub Dispose(ByVal disposing As
 Boolean)
        If disposing Then
            If Not (components Is
 Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub


    Private components As System.ComponentModel.IContainer

    <System.Diagnostics.DebuggerStepThrough()> Private Sub
 InitializeComponent()

        Me.SuspendLayout()

        '
        'Form1
        '
        Me.ClientSize = New System.Drawing.Size(648,
 398)
        Me.Name = "Form1"
        Me.Text = "Form1"
        Me.ResumeLayout(False)

    End Sub


    ' This method is called when a user preference changes.
    Private Sub SystemEvents_UserPreferenceChanging(
 _
    ByVal sender As Object,
 _
    ByVal e As UserPreferenceChangingEventArgs)

        MessageBox.Show("UserPreferenceChanging: "
 & _
        e.Category.ToString())
    End Sub


    ' This method is called when the palette changes.
    Private Sub SystemEvents_PaletteChanged(
 _
    ByVal sender As Object,
 _
    ByVal e As EventArgs)

        MessageBox.Show("PaletteChanged")

    End Sub


    ' This method is called when the display settings change.
    Private Sub SystemEvents_DisplaySettingsChanged(
 _
    ByVal sender As Object,
 _
    ByVal e As EventArgs)

        MessageBox.Show("The display settings changed.")

    End Sub

End Class
using System;
using Microsoft.Win32;

public sealed class App 
{
    static void Main() 
    {         
        // Set the SystemEvents class to receive event notification
 when a user 
        // preference changes, the palette changes, or when display
 settings change.
        SystemEvents.UserPreferenceChanging += new 
            UserPreferenceChangingEventHandler(SystemEvents_UserPreferenceChanging);
        SystemEvents.PaletteChanged += new 
            EventHandler(SystemEvents_PaletteChanged);
        SystemEvents.DisplaySettingsChanged += new 
            EventHandler(SystemEvents_DisplaySettingsChanged);        

        // For demonstration purposes, this application sits idle waiting
 for events.
        Console.WriteLine("This application is waiting for
 system events.");
        Console.WriteLine("Press <Enter> to terminate this
 application.");
        Console.ReadLine();
    }

    // This method is called when a user preference changes.
    static void SystemEvents_UserPreferenceChanging(object
 sender, UserPreferenceChangingEventArgs e) 
    {
        Console.WriteLine("The user preference is changing. Category={0}",
 e.Category);
    }

    // This method is called when the palette changes.
    static void SystemEvents_PaletteChanged(object
 sender, EventArgs e)
    {
        Console.WriteLine("The palette changed.");
    }

    // This method is called when the display settings change.
    static void SystemEvents_DisplaySettingsChanged(object
 sender, EventArgs e)
    {
        Console.WriteLine("The display settings changed.");
    }
}

// This code produces the following output.
// 
//  This app is waiting for system events.
//  Press <Enter> to terminate this application.
//  Display Settings changed.
//  User preference is changing. Category=General
#using <System.dll>

using namespace System;
using namespace Microsoft::Win32;

// This method is called when a user preference changes.
void SystemEvents_UserPreferenceChanging(Object^ sender,
     UserPreferenceChangingEventArgs^ e)
 {
     Console::WriteLine("The user preference is changing. Category={0}"
,
         e->Category);
 }

// This method is called when the palette changes.
void SystemEvents_PaletteChanged(Object^ sender, EventArgs^ e)
{
    Console::WriteLine("The palette changed.");
}

// This method is called when the display settings change.
void SystemEvents_DisplaySettingsChanged(Object^ sender,
    EventArgs^ e)
{
    Console::WriteLine("The display settings changed.");
}

int main()
{
    // Set the SystemEvents class to receive event notification
    // when a user preference changes, the palette changes, or
    // when display settings change.
    SystemEvents::UserPreferenceChanging += gcnew
        UserPreferenceChangingEventHandler(
        SystemEvents_UserPreferenceChanging);
    SystemEvents::PaletteChanged += gcnew
        EventHandler(SystemEvents_PaletteChanged);
    SystemEvents::DisplaySettingsChanged += gcnew
        EventHandler(SystemEvents_DisplaySettingsChanged);

    // For demonstration purposes, this application sits idle
    // waiting for events.
    Console::WriteLine("This application is waiting for system
 events.");
    Console::WriteLine("Press <Enter> to terminate this
 application.");
    Console::ReadLine();
}

// This code produces the following output.
//
//  This app is waiting for system events.
//  Press <Enter> to terminate this application.
//  Display Settings changed.
//  User preference is changing. Category=General
.NET Framework のセキュリティ.NET Frameworkセキュリティ
継承階層継承階層
System.Object
  Microsoft.Win32.SystemEvents
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
SystemEvents メンバ
Microsoft.Win32 名前空間
PowerModeChangedEventHandler デリゲート
SessionEndedEventHandler デリゲート
SessionEndingEventHandler デリゲート
SessionSwitchEventHandler デリゲート
TimerElapsedEventHandler
UserPreferenceChangedEventHandler
UserPreferenceChangingEventHandler

SystemEvents メソッド


パブリック メソッドパブリック メソッド

プロテクト メソッドプロテクト メソッド
参照参照

関連項目

SystemEvents クラス
Microsoft.Win32 名前空間
PowerModeChangedEventHandler デリゲート
SessionEndedEventHandler デリゲート
SessionEndingEventHandler デリゲート
SessionSwitchEventHandler デリゲート
TimerElapsedEventHandler
UserPreferenceChangedEventHandler
UserPreferenceChangingEventHandler

SystemEvents メンバ

システム イベント通知へのアクセス提供します。このクラス継承できません。

SystemEvents データ型公開されるメンバを以下の表に示します


パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
パブリック イベントパブリック イベント
  名前 説明
パブリック イベント DisplaySettingsChanged ユーザー表示設定変更する発生します
パブリック イベント DisplaySettingsChanging 表示設定変更されているときに発生します
パブリック イベント EventsThreadShutdown システム イベント待機するスレッド終了する前に発生します
パブリック イベント InstalledFontsChanged ユーザーシステム フォント追加するか、またはシステム フォント削除する発生します
パブリック イベント LowMemory システム使用可能な RAM不足する発生します
パブリック イベント PaletteChanged ユーザーが、別のパレット使用するアプリケーション切り替える発生します
パブリック イベント PowerModeChanged ユーザーシステム中断または再開する発生します
パブリック イベント SessionEnded ユーザーシステムからログオフするか、システムシャットダウンすると発生します
パブリック イベント SessionEnding ユーザーシステムからログオフようとした場合、またはシステムシャットダウンようとした場合発生します
パブリック イベント SessionSwitch 現在ログインしているユーザー変更され場合発生します
パブリック イベント TimeChanged ユーザーシステム時間変更する発生します
パブリック イベント TimerElapsed ウィンドウ タイマ間隔経過したときに発生します
パブリック イベント UserPreferenceChanged ユーザー設定変更される発生します
パブリック イベント UserPreferenceChanging ユーザー設定変更しているときに発生します
参照参照

関連項目

SystemEvents クラス
Microsoft.Win32 名前空間
PowerModeChangedEventHandler デリゲート
SessionEndedEventHandler デリゲート
SessionEndingEventHandler デリゲート
SessionSwitchEventHandler デリゲート
TimerElapsedEventHandler
UserPreferenceChangedEventHandler
UserPreferenceChangingEventHandler



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

辞書ショートカット

すべての辞書の索引

「SystemEvents」の関連用語











SystemEventsのお隣キーワード
検索ランキング

   

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



SystemEventsのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS