1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| Private Declare Function ShowWindowAsync Lib "user32.dll" (ByVal hWnd As IntPtr, ByVal nCmdShow As Integer) As Integer
Private Const SW_SHOWNOACTIVATE As Integer = 4i
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As IntPtr, ByVal nCmdShow As Int32) As Int32
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As IntPtr, ByVal hWndNewParent As IntPtr) As Integer
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As IntPtr, ByVal nIndex As Integer) As Integer
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As IntPtr, ByVal nIndex As Integer, ByVal dwNewLong As Integer) As Integer
Private Const GWL_EXSTYLE As Integer = (-20)
Private Const GWL_STYLE As Integer = (-16)
Private Const WS_CHILD As Integer= &H40000000
Private Const WS_EX_NOACTIVATE As Integer = &H8000000
Public Sub MyShow(ByVal hWndParent As IntPtr)
Dim GwlLExStyles As Integer = GetWindowLong(Me.Handle, GWL_EXSTYLE)
Dim GwlStyles As Integer = GetWindowLong(Me.Handle, GWL_STYLE)
SetWindowLong (Me.Handle, GWL_EXSTYLE, (GwlExStyles Or WS_EX_NOACTIVATE))
SetWindowLong (Me.Handle, GWL_STYLE, (GwlStyles Or WS_CHILD))
SetWindowLong (Me.Handle, GWL_HWNDPARENT, hWndParent.ToInt32)
SetParent(Me.Handle, hWndParent)
ShowWindowAsync(Me.Handle, SW_SHOWNOACTIVATE)
End Sub |
Partager