<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FC_Sharp%2FDevelopment_Class%2FSystemEvent</id>
		<title>Csharp/C Sharp/Development Class/SystemEvent - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FC_Sharp%2FDevelopment_Class%2FSystemEvent"/>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp/Development_Class/SystemEvent&amp;action=history"/>
		<updated>2026-04-29T21:46:33Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/C_Sharp/Development_Class/SystemEvent&amp;diff=1228&amp;oldid=prev</id>
		<title> в 15:31, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp/Development_Class/SystemEvent&amp;diff=1228&amp;oldid=prev"/>
				<updated>2010-05-26T15:31:19Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 15:31, 26 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/C_Sharp/Development_Class/SystemEvent&amp;diff=1229&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp/Development_Class/SystemEvent&amp;diff=1229&amp;oldid=prev"/>
				<updated>2010-05-26T11:45:21Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Demonstrates using the Microsoft.SystemEvents class to intercept an event generated by the system==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
C# Programming Tips &amp;amp; Techniques&lt;br /&gt;
by Charles Wright, Kris Jamsa&lt;br /&gt;
Publisher: Osborne/McGraw-Hill (December 28, 2001)&lt;br /&gt;
ISBN: 0072193794&lt;br /&gt;
*/&lt;br /&gt;
//&lt;br /&gt;
// Event.cs -- Demonstrates using the Microsoft.SystemEvents class to intercept&lt;br /&gt;
//             an event generated by the system.&lt;br /&gt;
//&lt;br /&gt;
//             Compile this program with the following command line:&lt;br /&gt;
//                 C:&amp;gt;csc Event.cs&lt;br /&gt;
//&lt;br /&gt;
namespace nsEvent&lt;br /&gt;
{&lt;br /&gt;
    using System;&lt;br /&gt;
    using System.Windows.Forms;&lt;br /&gt;
    using Microsoft.Win32;&lt;br /&gt;
    &lt;br /&gt;
    public class Event&lt;br /&gt;
    {&lt;br /&gt;
    //&lt;br /&gt;
    // Define the delegate&lt;br /&gt;
        public delegate void UserEventHandler (object obj, UserPreferenceChangedEventArgs args);&lt;br /&gt;
    //&lt;br /&gt;
    // Declare a variable that will hold the delegate&lt;br /&gt;
        static public event UserEventHandler ShowEvent;&lt;br /&gt;
        static public void Main ()&lt;br /&gt;
        {&lt;br /&gt;
    //&lt;br /&gt;
    // Create the delegate using the event handler (below)&lt;br /&gt;
              ShowEvent = new UserEventHandler (EvHandler);&lt;br /&gt;
    //&lt;br /&gt;
    // Creeate the event handler using the new operator&lt;br /&gt;
              UserPreferenceChangedEventHandler handler = new UserPreferenceChangedEventHandler(ShowEvent);&lt;br /&gt;
    //&lt;br /&gt;
    // Add the delegate to the system delegate list. This is a multi-cast delegate&lt;br /&gt;
    // and you must use the += operator to add the delegate. Use the -= operator&lt;br /&gt;
    // to remove the delegate&lt;br /&gt;
              SystemEvents.UserPreferenceChanged += handler;&lt;br /&gt;
    //&lt;br /&gt;
    // Show a message box to keep the program alive while you cause an event&lt;br /&gt;
              MessageBox.Show (&amp;quot;Hey! C Sharp&amp;quot;, &amp;quot;System Events&amp;quot;);&lt;br /&gt;
    //&lt;br /&gt;
    // Remove the delegate from the system delegate list&lt;br /&gt;
              SystemEvents.UserPreferenceChanged -= handler;&lt;br /&gt;
        }&lt;br /&gt;
    //&lt;br /&gt;
    // Declare and define the method that will be used as the event handler function&lt;br /&gt;
        static void EvHandler (object obj, UserPreferenceChangedEventArgs args)&lt;br /&gt;
        {&lt;br /&gt;
            /* Retrieve the category of the change */&lt;br /&gt;
            UserPreferenceCategory cat = args.Category;&lt;br /&gt;
            &lt;br /&gt;
            /* Build a string for the message box */&lt;br /&gt;
            string str = &amp;quot;User changed the &amp;quot; + cat.ToString() + &amp;quot; category&amp;quot;;&lt;br /&gt;
            /*  Show the change event */&lt;br /&gt;
            MessageBox.Show (str, &amp;quot; event category&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Hooking up to a Windows Callback==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
A Programmer&amp;quot;s Introduction to C# (Second Edition)&lt;br /&gt;
by Eric Gunnerson&lt;br /&gt;
Publisher: Apress  L.P.&lt;br /&gt;
ISBN: 1-893115-62-3&lt;br /&gt;
*/&lt;br /&gt;
// 31 - Interop\Calling Native DLL Functions\Hooking up to a Windows Callback&lt;br /&gt;
// copyright 2000 Eric Gunnerson&lt;br /&gt;
using System;&lt;br /&gt;
using System.Threading;&lt;br /&gt;
using System.Runtime.InteropServices;&lt;br /&gt;
&lt;br /&gt;
public class HookinguptoaWindowsCallback&lt;br /&gt;
{&lt;br /&gt;
    public static void MyHandler(ConsoleCtrl.ConsoleEvent consoleEvent)&lt;br /&gt;
    {&lt;br /&gt;
        Console.WriteLine(&amp;quot;Event: {0}&amp;quot;, consoleEvent);&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static void Main()&lt;br /&gt;
    {&lt;br /&gt;
        ConsoleCtrl cc = new ConsoleCtrl();&lt;br /&gt;
        cc.ControlEvent += new ConsoleCtrl.ControlEventHandler(MyHandler);&lt;br /&gt;
        &lt;br /&gt;
        Console.WriteLine(&amp;quot;Enter &amp;quot;E&amp;quot; to exit&amp;quot;);        &lt;br /&gt;
        &lt;br /&gt;
        Thread.Sleep(15000);    // sleep 15 seconds&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
public class ConsoleCtrl&lt;br /&gt;
{&lt;br /&gt;
    public enum ConsoleEvent&lt;br /&gt;
    {&lt;br /&gt;
        CTRL_C = 0,        // From wincom.h&lt;br /&gt;
        CTRL_BREAK = 1,&lt;br /&gt;
        CTRL_CLOSE = 2,&lt;br /&gt;
        CTRL_LOGOFF = 5,&lt;br /&gt;
        CTRL_SHUTDOWN = 6&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public delegate void ControlEventHandler(ConsoleEvent consoleEvent);&lt;br /&gt;
    &lt;br /&gt;
    public event ControlEventHandler ControlEvent;&lt;br /&gt;
    &lt;br /&gt;
    // save delegate so the GC doesn&amp;quot;t collect it.&lt;br /&gt;
    ControlEventHandler eventHandler;&lt;br /&gt;
    &lt;br /&gt;
    public ConsoleCtrl()&lt;br /&gt;
    {&lt;br /&gt;
        // save this to a private var so the GC doesn&amp;quot;t collect it&lt;br /&gt;
        eventHandler = new ControlEventHandler(Handler);&lt;br /&gt;
        SetConsoleCtrlHandler(eventHandler, true);&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    private void Handler(ConsoleEvent consoleEvent)&lt;br /&gt;
    {&lt;br /&gt;
        if (ControlEvent != null)&lt;br /&gt;
        ControlEvent(consoleEvent);&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    [DllImport(&amp;quot;kernel32.dll&amp;quot;)]&lt;br /&gt;
    static extern bool SetConsoleCtrlHandler(ControlEventHandler e, bool add);&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>