I need to open an external window from an external exe (eg Notepad) and move & size it to a predefined size & position.
I am trying to use MoveWindow API but is seems it is not working. I am using Windows 8 x64 and VS2012.
Here is my code:
<DllImport("user32.dll")> _
Public Function MoveWindow(ByVal hWnd As IntPtr, ByVal x As Integer, ByVal y As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal bRepaint As Boolean) As Boolean
End Function
Public Sub NoveNotepad()
Dim ApplicationProcess = System.Diagnostics.Process.Start("Notepad.exe")
ApplicationProcess.WaitForInputIdle()
Dim ApplicationHandle = ApplicationProcess.MainWindowHandle
Dim z = MoveWindow(ApplicationHandle, 600, 600, 600, 600, True) ' THIS RETURNS TRUE
End Sub