本文整理匯總了VB.NET中System.Windows.Forms.NativeWindow.WndProc方法的典型用法代碼示例。如果您正苦於以下問題:VB.NET NativeWindow.WndProc方法的具體用法?VB.NET NativeWindow.WndProc怎麽用?VB.NET NativeWindow.WndProc使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Windows.Forms.NativeWindow
的用法示例。
在下文中一共展示了NativeWindow.WndProc方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: MyNativeWindowListener
' NativeWindow class to listen to operating system messages.
Friend Class MyNativeWindowListener
Inherits NativeWindow
' Constant value was found in the "windows.h" header file.
Private Const WM_ACTIVATEAPP As Integer = &H1C
Private parent As Form1
Public Sub New(ByVal parent As Form1)
AddHandler parent.HandleCreated, AddressOf Me.OnHandleCreated
AddHandler parent.HandleDestroyed, AddressOf Me.OnHandleDestroyed
Me.parent = parent
End Sub
' Listen for the control's window creation and hook into it.
Private Sub OnHandleCreated(ByVal sender As Object, ByVal e As EventArgs)
' Window is now created, assign handle to NativeWindow.
AssignHandle(CType(sender, Form).Handle)
End Sub
Private Sub OnHandleDestroyed(ByVal sender As Object, ByVal e As EventArgs)
' Window was destroyed, release hook.
ReleaseHandle()
End Sub
<System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name:="FullTrust")> _
Protected Overrides Sub WndProc(ByRef m As Message)
' Listen for operating system messages
Select Case (m.Msg)
Case WM_ACTIVATEAPP
' Notify the form that this message was received.
' Application is activated or deactivated,
' based upon the WParam parameter.
parent.ApplicationActivated(m.WParam.ToInt32() <> 0)
End Select
MyBase.WndProc(m)
End Sub
End Class