- Message Struct
- Definition
- Examples
- Remarks
- Properties
- Methods
- Operators
- Control. Wnd Proc(Message) Метод
- Определение
- Параметры
- Примеры
- Комментарии
- Примечания для тех, кто наследует этот метод
- Message Box Класс
- Определение
- Примеры
- Комментарии
- Методы
- Message Структура
- Определение
- Примеры
- Комментарии
- Свойства
- Методы
- Операторы
Message Struct
Definition
Implements a Windows message.
Examples
The following code example demonstrates overriding the WndProc method to handle operating system messages identified in the Message. The WM_ACTIVATEAPP operating system message is handled in this example to know when another application is becoming active. For information about the available Message.Msg, Message.LParam, and Message.WParam values, see the MSG Structure documentation. For information about the actual constant values, see Message Constants.
Remarks
The Message structure wraps messages that Windows sends. You can use this structure to wrap a message and assign it to the window procedure to be dispatched. You can also use this structure to get information about a message the system sends to your application or controls. For more information about Windows messages, see Messages and Message Queues.
You cannot create the Message directly. Instead, use the Create method. For the sake of efficiency, the Message uses its pool of existing Messages instead of instantiating a new one, if possible. However, if a Message is not available in the pool, a new one is instantiated.
Properties
Gets or sets the window handle of the message.
Specifies the LParam field of the message.
Gets or sets the ID number for the message.
Specifies the value that is returned to Windows in response to handling the message.
Gets or sets the WParam field of the message.
Methods
Determines whether the specified object is equal to the current object.
Returns the hash code for this instance.
Gets the LParam value and converts the value to an object.
Returns a String that represents the current Message.
Operators
Determines whether two instances of Message are equal.
Determines whether two instances of Message are not equal.
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.
Message Box Класс
Определение
Отображает окно сообщения (диалоговое окно) с текстом для пользователя. Displays a message window, also known as a dialog box, which presents a message to the user. Это модальное окно, блокирующее другие действия в приложении, пока пользователь не закроет его. It is a modal window, blocking other actions in the application until the user closes it. MessageBox может содержать текст, кнопки и символы для отображения пользователю информации и инструкций. A MessageBox can contain text, buttons, and symbols that inform and instruct the user.
Примеры
В следующем примере кода показано, как использовать объект MessageBox для информирования пользователя об отсутствующей записи в TextBox . The following code example shows how to use a MessageBox to inform the user of a missing entry in a TextBox. Для этого примера требуется, чтобы метод вызывался из существующей формы с TextBox именем ServerName . This example requires that the method is called from an existing form with a TextBox named ServerName on it.
В следующем примере кода показано, как задать пользователю да или нет вопроса и принять решение, основанное на ответе. The following code example shows how to ask the user a yes or no question and make a decision based on the response.
Комментарии
Нельзя создать новый экземпляр MessageBox класса. You cannot create a new instance of the MessageBox class. Чтобы отобразить окно сообщения, вызовите static метод MessageBox.Show . To display a message box, call the static method MessageBox.Show. Заголовок, сообщение, кнопки и значки, отображаемые в окне сообщения, определяются параметрами, передаваемыми этому методу. The title, message, buttons, and icons displayed in the message box are determined by parameters that you pass to this method.
Методы
Определяет, равен ли указанный объект текущему объекту. Determines whether the specified object is equal to the current object.
(Унаследовано от Object)
Служит хэш-функцией по умолчанию. Serves as the default hash function.
(Унаследовано от Object)
Возвращает объект Type для текущего экземпляра. Gets the Type of the current instance.
(Унаследовано от Object)
Создает неполную копию текущего объекта Object. Creates a shallow copy of the current Object.
(Унаследовано от Object)
Отображает перед заданным объектом окно сообщения, содержащее заданный текст. Displays a message box in front of the specified object and with the specified text.
Отображает перед заданным объектом окно сообщения, содержащее заданный текст и заголовок. Displays a message box in front of the specified object and with the specified text and caption.
Отображает перед заданным объектом окно сообщения, содержащее заданный текст, заголовок и кнопки. Displays a message box in front of the specified object and with the specified text, caption, and buttons.
Отображает перед заданным объектом окно сообщения, содержащее заданный текст, заголовок, кнопки и значок. Displays a message box in front of the specified object and with the specified text, caption, buttons, and icon.
Отображает перед заданным объектом окно сообщения, содержащее заданный текст, заголовок, кнопки, значок и кнопку по умолчанию. Displays a message box in front of the specified object and with the specified text, caption, buttons, icon, and default button.
Отображает перед заданным объектом окно сообщения, содержащее заданный текст, заголовок, кнопки, значок, кнопку по умолчанию и параметры. Displays a message box in front of the specified object and with the specified text, caption, buttons, icon, default button, and options.
Отображает окно сообщения с заданным текстом, заголовком, кнопками, значком, кнопкой по умолчанию, параметрами для выбора, кнопкой «Справка», используя заданный файл справки. Displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button, using the specified Help file.
Отображает окно сообщения с заданным текстом, заголовком, кнопками, значком, кнопкой по умолчанию, параметрами для выбора, кнопкой «Справка», используя заданный файл справки и HelpNavigator . Displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button, using the specified Help file and HelpNavigator .
Отображает окно сообщения с заданным текстом, заголовком, кнопками, значком, кнопкой по умолчанию, параметрами для выбора, кнопкой «Справка», используя заданный файл справки, HelpNavigator и раздел справки. Displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button, using the specified Help file, HelpNavigator , and Help topic.
Отображает окно сообщения с заданным текстом, заголовком, кнопками, значком, кнопкой по умолчанию, параметрами для выбора, кнопкой «Справка», используя заданный файл справки и Ключевое слово справки. Displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button, using the specified Help file and Help keyword.
Отображает окно сообщения с заданным текстом. Displays a message box with specified text.
Отображает окно сообщения с заданным текстом и заголовком. Displays a message box with specified text and caption.
Отображает окно сообщения с заданным текстом, заголовком и кнопками. Displays a message box with specified text, caption, and buttons.
Отображает окно сообщения с заданным текстом, заголовком, кнопками и значком. Displays a message box with specified text, caption, buttons, and icon.
Отображает окно сообщения с заданным текстом, заголовком, кнопками, значком и кнопкой по умолчанию. Displays a message box with the specified text, caption, buttons, icon, and default button.
Отображает окно сообщения с заданным текстом, заголовком, кнопками, значком, кнопкой по умолчанию и параметрами для выбора. Displays a message box with the specified text, caption, buttons, icon, default button, and options.
Отображает окно сообщения с заданным текстом, заголовком, кнопками, значком, кнопкой по умолчанию, параметрами для выбора и кнопкой «Справка». Displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button.
Отображает окно сообщения с заданным текстом, заголовком, кнопками, значком, кнопкой по умолчанию, параметрами для выбора, кнопкой «Справка», используя заданный файл справки. Displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button, using the specified Help file.
Отображает окно сообщения с заданным текстом, заголовком, кнопками, значком, кнопкой по умолчанию, параметрами для выбора, кнопкой «Справка», используя заданный файл справки и HelpNavigator . Displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button, using the specified Help file and HelpNavigator .
Отображает окно сообщения с заданным текстом, заголовком, кнопками, значком, кнопкой по умолчанию, параметрами для выбора, кнопкой «Справка», используя заданный файл справки, HelpNavigator и раздел справки. Displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button, using the specified Help file, HelpNavigator , and Help topic.
Отображает окно сообщения с заданным текстом, заголовком, кнопками, значком, кнопкой по умолчанию, параметрами для выбора, кнопкой «Справка», используя заданный файл справки и Ключевое слово справки. Displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button, using the specified Help file and Help keyword.
Возвращает строку, представляющую текущий объект. Returns a string that represents the current object.
Message Структура
Определение
Реализует сообщение Windows. Implements a Windows message.
Примеры
В следующем примере кода показано переопределение WndProc метода для работы с сообщениями операционной системы, определенными в Message . The following code example demonstrates overriding the WndProc method to handle operating system messages identified in the Message. Сообщение операционной системы 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 значениях, и см. в документации по структуре сообщения . For information about the available Message.Msg, Message.LParam, and Message.WParam values, see the MSG Structure documentation. Сведения о фактических значениях констант см. в разделе константы сообщения. For information about the actual constant values, see Message Constants.
Комментарии
MessageСтруктура служит оболочкой для сообщений, отправляемых Windows. The Message structure wraps messages that Windows sends. Эту структуру можно использовать для создания оболочки сообщения и назначения ее процедуре окна для отправки. You can use this structure to wrap a message and assign it to the window procedure to be dispatched. Эту структуру также можно использовать для получения сведений о сообщении, которое система отправляет в приложение или элементы управления. You can also use this structure to get information about a message the system sends to your application or controls. Дополнительные сведения о сообщениях Windows см. в разделе сообщения и очереди сообщений. For more information about Windows messages, see Messages and Message Queues.
Нельзя создать Message напрямую. You cannot create the Message directly. Вместо этого используйте Create метод. Instead, use the Create method. В целях повышения эффективности Message компонент использует пул существующих объектов Message , а не создает новый экземпляр, если это возможно. For the sake of efficiency, the Message uses its pool of existing Messages instead of instantiating a new one, if possible. Однако если в Message пуле недоступен, создается новый экземпляр. However, if a Message is not available in the pool, a new one is instantiated.
Свойства
Получает или задает дескриптор окна сообщения. Gets or sets the window handle of the message.
Задает поле LParam сообщения. Specifies the LParam field of the message.
Получает или задает идентификатор сообщения. Gets or sets the ID number for the message.
Указывает значение, возвращаемое операционной системе Windows в ответ на обработку сообщения. Specifies the value that is returned to Windows in response to handling the message.
Получает или задает поле WParam сообщения. Gets or sets the WParam field of the message.
Методы
Создает новый экземпляр Message. Creates a new Message.
Определяет, равен ли указанный объект текущему объекту. Determines whether the specified object is equal to the current object.
Возвращает хэш-код данного экземпляра. Returns the hash code for this instance.
Получает значение LParam и преобразует его в объект. Gets the LParam value and converts the value to an object.
Возвращает значение типа String, представляющее текущий объект Message. Returns a String that represents the current Message.
Операторы
Определяет равенство двух экземпляров класса Message. Determines whether two instances of Message are equal.
Определяет неравенство двух экземпляров класса Message. Determines whether two instances of Message are not equal.