You don't have to use GetWindowInfo API to get the information you want. Instead, you can use GetWindowRect to find out the coordinates and GetForgroundWindow to find ou the window that has a focus.
For this example I've used a form in my project, but you can substitute that with the valid Window Handle (hWnd) of your choice.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 GetForegroundWindow Lib "user32" () As Long Private Sub Command1_Click() Dim rec As RECT Dim lHwnd As Long Dim strMsg As String Call GetWindowRect(Me.hwnd, rec) lHwnd = GetForegroundWindow strMsg = "X: " & rec.Left & vbCrLf strMsg = strMsg & "Y: " & rec.Top & vbCrLf If lHwnd = Me.hwnd Then strMsg = strMsg & "Window is the windows that has focus." Else strMsg = strMsg & "Window is the windows that doesn't have focus." End If MsgBox strMsg End Sub
------------------
Serge
Senior Programmer Analyst
[email protected]
[email protected]
ICQ#: 51055819
[This message has been edited by Serge (edited 02-03-2000).]




Reply With Quote