|
-
July 10th, 2008, 01:09 AM
#15
Re: Resize 3rd Party Application
TT(n), great mind think alike 
Well, there are actually 3 ways to approach this :
1) MoveWindow - which is basically the easiest, and which I'll show 
2) SendMessage - use the WM_SIZE constant
3) SetWindowsPos - where you could supply starting X and Y values, as well as Width and Height, and some flags to make the window un - resizable, or always on top etc.
Here is an example ( which works ) using MoveWindow :
Code:
'Import the System.Runtime.InterOpServices Namespace
<DllImport("user32.dll", EntryPoint:="MoveWindow", CharSet:=CharSet.Auto)> _
Public Shared Function MoveWindow(ByVal hWnd As IntPtr, _
ByVal X As Int32, _
ByVal Y As Int32, _
ByVal nWidth As Int32, _
ByVal nHeight As Int32, _
ByVal bRepaint As Boolean _
) As Boolean
End Function
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim NoteProc() As Process = Process.GetProcessesByName("notepad") 'Get Notepad's handle
MoveWindow(NoteProc(0).MainWindowHandle, 10, 10, 200, 300, True) 'Resize
End Sub
Easy as pie, isn't it ¿
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|