|
-
Feb 9th, 2003, 11:18 AM
#1
Thread Starter
Frenzied Member
Resize the window of another running program
Is there a way that I can check for existence of a special window outside of my program and if it exists resize it ? you know, I am talking about a window, not a process; in my case the main process may have multiple open windows each having a title, the only property of the window that I know.
-
Feb 9th, 2003, 10:29 PM
#2
Sleep mode
it's VB6 version .I didn't convert it to .NET thought.
VB Code:
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Const KEYEVENTF_KEYUP = &H2
Const VK_LWIN = &H5B
'in a form
' 77 is the character code for the letter 'M'
Call keybd_event(VK_LWIN, 0, 0, 0)
Call keybd_event(77, 0, 0, 0)
Call keybd_event(VK_LWIN, 0, KEYEVENTF_KEYUP, 0)
hope it works !
-
Feb 10th, 2003, 01:07 AM
#3
Thread Starter
Frenzied Member
Sorry, but i cant understand how to pass the window name and its new size to this API.
-
Feb 10th, 2003, 05:21 AM
#4
Hyperactive Member
-
Feb 10th, 2003, 11:52 AM
#5
Sleep mode
just look at this , it might solve your problem.
-
Feb 10th, 2003, 02:27 PM
#6
Thread Starter
Frenzied Member
I dont want to minimize or maximize the window, i want to resize it for example have it 400x400.
-
Feb 10th, 2003, 04:11 PM
#7
Sleep mode
Originally posted by Lunatic3
I dont want to minimize or maximize the window, i want to resize it for example have it 400x400.
Is it working ? I mean mimizing and maxi.??
-
Feb 26th, 2003, 10:38 AM
#8
New Member
Answer??
I'm stuck with the same problem!! did you ever figure out how to do it?
-
Feb 26th, 2003, 11:45 AM
#9
Thread Starter
Frenzied Member
No, I have not find a way yet, ofcourse I didnt have time to search for it in the past days and havent tried the method presented by Pirate yet, If i find a way i will post it here.
-
Feb 26th, 2003, 12:34 PM
#10
New Member
Sorted it Man!..
Try this fella.. it works.
'MODULE CODE
'***********************************************
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Public Function SetWP(ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long)
SetWindowPos hwnd, hWndInsertAfter, x, y, cx, cy, wFlags
End Function
'FORM CODE
'***********************************************
Public Sub Command1_Click()
'hwnd you need to find the handle of the application your wanting to resize.
Module1.SetWP hwnd, 0, txtLeft, txtTop, txtWidthX, txtHeightY, 0
End Sub
-
Feb 26th, 2003, 04:19 PM
#11
Thread Starter
Frenzied Member
Thanks man!
Just you have to replace 'Long' with 'Integer' in your declarations and it works great
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
|