How hard can it be?
Hmmm - seems I'm doing something wrong with GETWINDOWRECT.
I've simplified as much as possible, but still only get 0,0,0,0 back in my "rect"
Any one seen this?
Running Windows 7, VB 2008
FORM:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim wRect, cRect As RECT
Myhandle = Me.Handle
GetWindowRect(Myhandle, wRect)
MsgBox("WINDOW: " & wRect.Top.ToString & " - " & wRect.Left.ToString & " - " & wRect.Bottom.ToString & " - " & wRect.Right.ToString)
GetClientRect(Myhandle, cRect)
MsgBox("CLIENT WINDOW: " & cRect.Top.ToString & " - " & cRect.Left.ToString & " - " & cRect.Bottom.ToString & " - " & cRect.Right.ToString)
End Sub
--------------
MODULE:
Declare Auto Function GetWindowRect Lib "user32" (ByVal hWnd As IntPtr, ByVal lpRect As RECT) As Integer
Declare Auto Function GetClientRect Lib "user32" (ByVal hwnd As IntPtr, ByVal lpRect As RECT) As Integer
Public Structure RECT
Dim Left As Integer
Dim Top As Integer
Dim Right As Integer
Dim Bottom As Integer
End Structure
Public MyPROCESS As New Process
Public Myhandle As IntPtr
Hmmm - seems I'm doing something wrong with GETWINDOWRECT.
I've simplified as much as possible, but still only get 0,0,0,0 back in my "rect"
Any one seen this?
Running Windows 7, VB 2008
FORM:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim wRect, cRect As RECT
Myhandle = Me.Handle
GetWindowRect(Myhandle, wRect)
MsgBox("WINDOW: " & wRect.Top.ToString & " - " & wRect.Left.ToString & " - " & wRect.Bottom.ToString & " - " & wRect.Right.ToString)
GetClientRect(Myhandle, cRect)
MsgBox("CLIENT WINDOW: " & cRect.Top.ToString & " - " & cRect.Left.ToString & " - " & cRect.Bottom.ToString & " - " & cRect.Right.ToString)
End Sub
--------------
MODULE:
Declare Auto Function GetWindowRect Lib "user32" (ByVal hWnd As IntPtr, ByVal lpRect As RECT) As Integer
Declare Auto Function GetClientRect Lib "user32" (ByVal hwnd As IntPtr, ByVal lpRect As RECT) As Integer
Public Structure RECT
Dim Left As Integer
Dim Top As Integer
Dim Right As Integer
Dim Bottom As Integer
End Structure
Public MyPROCESS As New Process
Public Myhandle As IntPtr