|
-
Feb 26th, 2000, 09:53 PM
#1
Thread Starter
Lively Member
How can I recieve a windows Width, Height, Top, Left, by just knowing it's caption or hWnd ?
And how can I resize a window to any Height, Width, Top, Left, that I want, by just knowing the windows hWnd or Caption ?
The Windows is not part of my program, like, how do I resize Windows Explorer, from within my program, and know it's current size ?
Please help me.
-
Feb 27th, 2000, 12:38 PM
#2
You can try something like this:
Code:
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Sub Form_Load()
Dim lHwnd As Long
Dim rc As RECT
Dim strMsg As String
lHwnd = FindWindowEx(0, 0, vbNullString, "CaptionOfProgram")
Call GetWindowRect(lHwnd, rc)
strMsg = "Height: " & rc.Bottom - rc.Top & vbCrLf
strMsg = strMsg & "Width: " & rc.Right - rc.Left & vbCrLf
strMsg = strMsg & "Top: " & rc.Top & vbCrLf
strMsg = strMsg & "Left: " & rc.Left
End Sub
Just substitute CaptionOfProgram with the appropriate caption.
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
|