那这个呢!?
Imports System.ComponentModel
Imports System.Runtime.InteropServices
Public Class Form1
<DllImport("user32.dll", SetLastError:=True)>
Private Shared Function MoveWindow(hWnd As IntPtr, X As Integer, Y As Integer, nWidth As Integer, nHeight As Integer, bRepaint As Boolean) As Boolean
End Function
<DllImport("user32.dll")>
Private Shared Function SetParent(hWndChild As IntPtr, hWndNewParent As IntPtr) As IntPtr
End Function
<DllImportAttribute("user32.dll")>
Public Shared Function SendMessage(ByVal hWnd As IntPtr, ByVal Msg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
End Function
Public ENotepad As New Process()
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.DoubleBuffered = True
Notepad()
End Sub
Private Sub Form1_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing
Try
ENotepad.Kill()
Catch
End Try
End Sub
Private Sub Notepad()
ENotepad.StartInfo.FileName = "C:\Program Files\Notepad++\notepad++.exe" 'Application.StartupPath() & "\notepad++.exe"
'ENotepad.StartInfo.Arguments = ""
ENotepad.StartInfo.CreateNoWindow = True
ENotepad.StartInfo.RedirectStandardOutput = True
ENotepad.StartInfo.UseShellExecute = False
ENotepad.EnableRaisingEvents = True
'AddHandler Notepad.OutputDataReceived, Sub(o, e) Debug.WriteLine(If(e.Data, "NULL"), "Notepad")
'AddHandler Notepad.ErrorDataReceived, Sub(o, e) Debug.WriteLine(If(e.Data, "NULL"), "Notepad")
'AddHandler Notepad.Exited, Sub(o, e) Debug.WriteLine("Exited", "Notepad")
ENotepad.Start()
Thread.Sleep(1000)
Try
SetParent(ENotepad.MainWindowHandle, Me.Handle)
MoveWindow(ENotepad.MainWindowHandle, 0, 0, 320, 180, True)
'MoveWindow(ENotepad.MainWindowHandle, -5, -30, 320, 280, True)
Catch ex As Exception
Me.Text = "missed!"
End Try
End Sub
End Class