How do I run a windows program from VB and at the same time set that windows position on the screen and size?
Printable View
How do I run a windows program from VB and at the same time set that windows position on the screen and size?
Code:Private Declare Function MoveWindow Lib "user32" (ByVal hwnd As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long
Private Declare Function GetForegroundWindow Lib "user32" () As Long
Private Sub Form_Load()
'The app to run
Shell "notepad.exe", vbNormalFocus
'Fill in the coordinates x,y,width,height
MoveWindow GetForegroundWindow, 10, 10, 100, 100, 1
End Sub
Thx :))