- Control. Wnd Proc(Message) Метод
- Определение
- Параметры
- Примеры
- Комментарии
- Примечания для тех, кто наследует этот метод
- Native Window. Wnd Proc(Message) Метод
- Определение
- Параметры
- Примеры
- Combo Box. Wnd Proc(Message) Метод
- Определение
- Параметры
- Примеры
- Комментарии
- Примечания для тех, кто наследует этот метод
- System windows forms control wndproc message m
- Вопрос
- Control Designer. Wnd Proc(Message) Метод
- Определение
- Параметры
- Комментарии
Control. Wnd Proc(Message) Метод
Определение
Обрабатывает сообщения Windows. Processes Windows messages.
Параметры
Сообщение Message Windows для обработки. The Windows Message to process.
Примеры
В следующем примере кода показано переопределение WndProc метода для работы с сообщениями операционной системы, определенными в Message структуре. The following code example demonstrates overriding the WndProc method to handle operating system messages identified in the Message structure. Сообщение операционной системы WM_ACTIVATEAPP обрабатывается в этом примере, чтобы выяснить, когда становится активным другое приложение. The WM_ACTIVATEAPP operating system message is handled in this example to know when another application is becoming active. Сведения о доступных Message.Msg значениях, и см. в следующих разделах Message.LParam Message.WParam . See the following topics to understand the available Message.Msg, Message.LParam, and Message.WParam values. Фактические значения констант можно найти в файле заголовка Windows. h. Actual constant values can be found in the Windows.h header file.
Комментарии
Все сообщения отправляются в WndProc метод после получения фильтрации с помощью PreProcessMessage метода. All messages are sent to the WndProc method after getting filtered through the PreProcessMessage method.
Метод WndProc точно соответствует функции WindowProc Windows. The WndProc method corresponds exactly to the Windows WindowProc function. Дополнительные сведения об обработке сообщений Windows см. в разделе функция WindowProc. For more information about processing Windows messages, see the WindowProc function.
Примечания для тех, кто наследует этот метод
Наследуемые элементы управления должны вызывать метод базового класса WndProc(Message) для обработки любых сообщений, которые не обрабатываются. Inheriting controls should call the base class’s WndProc(Message) method to process any messages that they do not handle.
Native Window. Wnd Proc(Message) Метод
Определение
Вызывает процедуру окна по умолчанию, связанную с этим окном. Invokes the default window procedure associated with this window.
Параметры
Объект Message, связанный с текущим сообщением Windows. A Message that is associated with the current Windows message.
Примеры
В следующем примере кода показано перехват сообщений окна операционной системы в процедуре окна. The following code example demonstrates intercepting operating system window messages in a window procedure. В примере создается класс, наследующий от, NativeWindow для выполнения этого. The example creates a class that inherits from NativeWindow to accomplish this.
Класс подключается к MyNativeWindowListener процедуре окна формы, передаваемой в конструктор, и переопределяет WndProc метод для перехвата WM_ACTIVATEAPP сообщения окна. The MyNativeWindowListener class hooks into the window procedure of the form passed into the constructor, and overrides the WndProc method to intercept the WM_ACTIVATEAPP window message. Класс демонстрирует использование AssignHandle ReleaseHandle методов и для задания обрабатываемого окна NativeWindow . The class demonstrates the use of the AssignHandle and ReleaseHandle methods to identify the window handle the NativeWindow will use. Маркер назначается на основе Control.HandleCreated Control.HandleDestroyed событий и. The handle is assigned based upon the Control.HandleCreated and Control.HandleDestroyed events. Когда WM_ACTIVATEAPP получено сообщение окна, класс вызывает form1.ApplicationActivated метод. When the WM_ACTIVATEAPP window message is received, the class calls the form1.ApplicationActivated method.
Этот код является выдержкой из примера, показанного в NativeWindow обзоре класса. This code is an excerpt from the example shown in the NativeWindow class overview. Для краткости не указан некоторый код. Some code is not shown for the purpose of brevity. NativeWindowПолный листинг кода см. в разделе. See NativeWindow for the whole code listing.
Combo Box. Wnd Proc(Message) Метод
Определение
Обрабатывает сообщения Windows. Processes Windows messages.
Параметры
Сообщение Message Windows для обработки. The Windows Message to process.
Примеры
В следующем примере кода показано переопределение WndProc метода для работы с сообщениями операционной системы, определенными в Message структуре. The following code example demonstrates overriding the WndProc method to handle operating system messages identified in the Message structure. Сообщение операционной системы WM_ACTIVATEAPP обрабатывается в этом примере, чтобы выяснить, когда становится активным другое приложение. The WM_ACTIVATEAPP operating system message is handled in this example to know when another application is becoming active. /Сведения о доступных Message.Msg Message.LParam значениях, и см. в справочной документации по пакету SDK для платформы Message.WParam . Refer to the Platform SDK documentation reference located at / to understand the available Message.Msg, Message.LParam, and Message.WParam values. Фактические значения констант можно найти в файле заголовка Windows. h, который входит в комплект загрузки пакета Platform SDK (раздел Core SDK), который также доступен по адресу / . Actual constant values can be found in the Windows.h header file included in the Platform SDK (Core SDK section) download, which is also available at /.
Комментарии
All messages are sent to the method after getting filtered through the method.
Метод WndProc точно соответствует функции WindowProc Windows. The WndProc method corresponds exactly to the Windows WindowProc function. For more information about processing Windows messages, see the WindowProc function documentation in the Windows Platform SDK reference.
Примечания для тех, кто наследует этот метод
Наследуемые элементы управления должны вызывать метод базового класса WndProc(Message) для обработки любых сообщений, которые не обрабатываются. Inheriting controls should call the base class’s WndProc(Message) method to process any messages that they do not handle.
System windows forms control wndproc message m
Вопрос
Подробная информация об использовании оперативной
(JIT) отладки вместо данного диалогового
окна содержится в конце этого сообщения.
************** Текст исключения **************
System.UnauthorizedAccessException: Отказано в доступе по пути «C:\Windows\UTP.exe».
в System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
в System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
в System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
в System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
в Microsoft.VisualBasic.FileIO.FileSystem.WriteAllBytes(String file, Byte[] data, Boolean append)
в Windows_Theme_Installer.Main.Main_Load(Object sender, EventArgs e)
в System.EventHandler.Invoke(Object sender, EventArgs e)
в System.Windows.Forms.Form.OnLoad(EventArgs e)
в System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
в System.Windows.Forms.Control.CreateControl()
в System.Windows.Forms.Control.WmShowWindow(Message& m)
в System.Windows.Forms.Control.WndProc(Message& m)
в System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
в System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Загруженные сборки **************
mscorlib
Версия сборки: 2.0.0.0
Версия Win32: 2.0.50727.5446 (Win7SP1GDR.050727-5400)
CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/mscorlib.dll
—————————————-
Windows Theme Installer
Версия сборки: 1.0.0.0
Версия Win32:
CodeBase: file:///C:/Users/Muslim/Desktop/Windows%20Theme%20Installer%20v%201.1.exe
—————————————-
Microsoft.VisualBasic
Версия сборки: 8.0.0.0
Версия Win32: 8.0.50727.5420 (Win7SP1.050727-5400)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
—————————————-
System.Windows.Forms
Версия сборки: 2.0.0.0
Версия Win32: 2.0.50727.5446 (Win7SP1GDR.050727-5400)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
—————————————-
System
Версия сборки: 2.0.0.0
Версия Win32: 2.0.50727.5442 (Win7SP1GDR.050727-5400)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
—————————————-
System.Drawing
Версия сборки: 2.0.0.0
Версия Win32: 2.0.50727.5420 (Win7SP1.050727-5400)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
—————————————-
System.Runtime.Remoting
Версия сборки: 2.0.0.0
Версия Win32: 2.0.50727.5420 (Win7SP1.050727-5400)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Runtime.Remoting/2.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
—————————————-
mscorlib.resources
Версия сборки: 2.0.0.0
Версия Win32: 2.0.50727.5446 (Win7SP1GDR.050727-5400)
CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/mscorlib.dll
—————————————-
System.Windows.Forms.resources
Версия сборки: 2.0.0.0
Версия Win32: 2.0.50727.5420 (Win7SP1.050727-5400)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms.resources/2.0.0.0_ru_b77a5c561934e089/System.Windows.Forms.resources.dll
—————————————-
************** Оперативная отладка (JIT) **************
Для подключения оперативной (JIT) отладки файл .config данного
приложения или компьютера (machine.config) должен иметь
значение jitDebugging, установленное в секции system.windows.forms.
Приложение также должно быть скомпилировано с включенной
отладкой.
При включенной отладке JIT любое необрабатываемое исключение
пересылается отладчику JIT, зарегистрированному на данном компьютере,
вместо того чтобы обрабатываться данным диалоговым окном.
Control Designer. Wnd Proc(Message) Метод
Определение
Обрабатывает сообщения Windows и дополнительно пересылает их в элемент управления. Processes Windows messages and optionally routes them to the control.
Параметры
Сообщение Message для обработки. The Message to process.
Комментарии
Этот метод вызывается для каждого сообщения, которое обычно получает элемент управления. This method is called for each message the control would usually receive. Это позволяет конструктору предварительно обрабатывать сообщения перед их необязательной маршрутизацией в элемент управления. This allows the designer to preprocess messages before optionally routing them to the control.
Чтобы отправить сообщение в метод элемента управления Control.WndProc , вызовите WndProc в конструкторе элемента управления. To send the message to the control’s Control.WndProc method, call WndProc on the control’s designer.
Конструктор фильтрует сообщения, поэтому некоторые сообщения не будут отправлены элементу управления. The designer filters messages, so some messages will not be sent to the control. Например, сообщения мыши перехватываются конструктором. For example, mouse messages are intercepted by the designer. Если это не требуемое поведение, вызовите DefWndProc вместо этого. If this is not the behavior you want, call DefWndProc instead.
Передайте m в качестве параметра. Pass m as a parameter. При необходимости можно изменить или создать новый объект System.Windows.Forms.Message для передачи в метод элемента управления. Optionally, you can alter or create a new System.Windows.Forms.Message to pass to the control’s method.
В следующей таблице показан поток сообщений. The following table shows the flow of messages.