La Web del Programador: Comunidad de Programadores
 
    Pregunta:  1747 - COMO PUEDO SABER EN KE RESOLUCION ESTA TRABAJANDO UN USUARIO
Autor:  Real Curly
Hola Quisiera saber como puedo desde VB averiguar en ke resolucion de pantalla y profundidad de colores se esta trabajando en un equipo?? Desde ya muchas gracias. :D

  Respuesta:  Real Curly
Hola a mi mismo ke respondi mi pregunta :p Al final encontre la solucion!! Bueno, pero aca la dejo por si a otro le hace falta.
Ya se como obtener informacion sobre la resolucion, lo ke no pude lograr es obtener la profundidad de colore.. pero bueno, igual sirve. Aqui va.


Option Explicit
´ Como determinar resolución de la
´ pantalla con VB-Win95/NT.
´ Dos versiones- con el API y sin...
´ Pon tres botones y un textbox encima de
´ un form y insertar este codigo.
´

Private Declare Function GetSystemMetrics Lib "user32" _
(ByVal nIndex As Long) As Long

Private Sub Command1_Click()
Dim resolucionX&, resolucionY&
resolucionX = GetSystemMetrics(0)
resolucionY = GetSystemMetrics(1)
Text1.Text = CStr(resolucionX & "x" & resolucionY)
End Sub

Private Sub Command2_Click()
Dim resolucionX&, resolucionY&
resolucionX = Screen.Width / Screen.TwipsPerPixelX
resolucionY = Screen.Height / Screen.TwipsPerPixelY
Text1.Text = CStr(resolucionX & "x" & resolucionY)
End Sub

Private Sub Command3_Click()
Text1.Text = ""
End Sub

Private Sub Form_Load()
Text1.Text = ""
Command1.Caption = "&Con API"
Command2.Caption = "&Sin API"
Command3.Caption = "&Borrar"
Me.Caption = "Obtener resolucionen uso"
End Sub