1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
Imports System.Runtime.InteropServices
Public Class Form1
Public Shared Function SetWindowPos(ByVal hWnd As IntPtr, ByVal hWndInsertAfter As IntPtr, ByVal X As Integer, ByVal Y As Integer, ByVal cx As Integer, ByVal cy As Integer, ByVal uFlags As Integer) As Boolean
End Function
<DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
Public Shared Function SetParent(ByVal hWndChild As IntPtr, ByVal hWndNewParent As IntPtr) As IntPtr
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim p As Process
p = Process.Start("G:\Program files\Notepad\notepad++.exe")
p.WaitForInputIdle()
SetParent(p.MainWindowHandle, Me.Handle)
SetWindowPos(p.MainWindowHandle, IntPtr.Zero, 50, 50, 60, 50, 0)
End Sub
End Class |
Partager