1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
Imports System.Runtime.InteropServices
Public Class Form1
Private Property hwnd As Long
Private Property ProcessPID As Object
Private Property ProcessHwnd As Object
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("C:\Program Files (x86)\Notepad++\notepad++.exe")
SetWindowPos(p.Handle, IntPtr.Zero, 0, 0, 400, 300, 0)
End Sub
End Class |
Partager