Visual Basic Foro
Programación => Visual Basic 6 => Mensaje iniciado por: ..::Carlos::.. en Febrero 05, 2012, 07:09:32 am
-
Hola amigos como estas miren haber si me pueden echar una mano como puedo saber cual es el tamaño, posicion y tamaño interior de la ventana activa
Gracias
-
Este es para saber cual es la ventana activa
http://www.recursosvisualbasic.com.ar/htm/trucos-codigofuente-visual-basic/23.htm (http://www.recursosvisualbasic.com.ar/htm/trucos-codigofuente-visual-basic/23.htm)
http://www.recursosvisualbasic.com.ar/htm/listado-api/138-GetWindowText.htm (http://www.recursosvisualbasic.com.ar/htm/listado-api/138-GetWindowText.htm)
Para saber el tamaño de la ventana no se. :'(
-
GetWindowRect te da el tamaño en pixeles :)
-
hola si te referiz a la parte cliente con estas apis
ClientToScreen para saber la x e y de la ventana cliente
GetClientRect para saber el width y height de la ventana cliente
GetForegroundWindow para saber la ventana activa
Option Explicit
Private Declare Function ClientToScreen Lib "user32.dll" (ByVal hwnd As Long, ByRef lpPoint As POINTAPI) As Long
Private Declare Function GetClientRect Lib "user32.dll" (ByVal hwnd As Long, ByRef lpRect As RECT) As Long
Private Declare Function GetForegroundWindow Lib "user32.dll" () As Long
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Type POINTAPI
x As Long
y As Long
End Type
Private Sub Form_Load()
Timer1.Interval = 100
End Sub
Private Sub Timer1_Timer()
Dim Handle As Long
Dim tRect As RECT
Dim tPT As POINTAPI
Handle = GetForegroundWindow
GetClientRect Handle, tRect
ClientToScreen Handle, tPT
Me.Cls
Me.Print Handle, tPT.x, tPT.y, tRect.Right, tRect.Bottom
End Sub
Saludos.