Mais cette technique comporte un bug, comme décrit dans http://support.microsoft.com/default.aspx?scid%3940
La résolution proposée par cette fiche pourrait être codée comme ceci (non testé): Private Declare Function GetDeviceCaps _ Lib "gdi32" _ ( _ ByVal hDC As Long, _ ByVal nIndex As Long _ ) _ As Long Private Declare Function GetDC _ Lib "user32" _ ( _ ByVal hwnd As Long _ ) _ As Long Private Declare Function GetWindowDC _ Lib "user32" _ ( _ ByVal hwnd As Long _ ) _ As Long Private Declare Function GetDesktopWindow _ Lib "user32" _ ( _ ) _ As Long
Const HORZRES = 8 Const VERTRES = 10
Dim ScreenDC As Long Dim ScreenWidth As Long Dim ScreenHeight As Long
Mais cette technique comporte un bug, comme décrit dans
http://support.microsoft.com/default.aspx?scid%3940
La résolution proposée par cette fiche pourrait être codée comme ceci (non
testé):
Private Declare Function GetDeviceCaps _
Lib "gdi32" _
( _
ByVal hDC As Long, _
ByVal nIndex As Long _
) _
As Long
Private Declare Function GetDC _
Lib "user32" _
( _
ByVal hwnd As Long _
) _
As Long
Private Declare Function GetWindowDC _
Lib "user32" _
( _
ByVal hwnd As Long _
) _
As Long
Private Declare Function GetDesktopWindow _
Lib "user32" _
( _
) _
As Long
Const HORZRES = 8
Const VERTRES = 10
Dim ScreenDC As Long
Dim ScreenWidth As Long
Dim ScreenHeight As Long
Mais cette technique comporte un bug, comme décrit dans http://support.microsoft.com/default.aspx?scid%3940
La résolution proposée par cette fiche pourrait être codée comme ceci (non testé): Private Declare Function GetDeviceCaps _ Lib "gdi32" _ ( _ ByVal hDC As Long, _ ByVal nIndex As Long _ ) _ As Long Private Declare Function GetDC _ Lib "user32" _ ( _ ByVal hwnd As Long _ ) _ As Long Private Declare Function GetWindowDC _ Lib "user32" _ ( _ ByVal hwnd As Long _ ) _ As Long Private Declare Function GetDesktopWindow _ Lib "user32" _ ( _ ) _ As Long
Const HORZRES = 8 Const VERTRES = 10
Dim ScreenDC As Long Dim ScreenWidth As Long Dim ScreenHeight As Long
"Patrick FREDIN" a écrit dans le message de news:uEUPM7%
Bonjour,
Comment puis-je connaître la résolution de écran ? Je voudrais utiliser ce résultat pour redimensionner des fenêtres.
Merci pour votre aide.
ng
Salut,
Tu peux obtenir la résolution en pixel très simplement grace a l'objet Screen :
Dim ResX As Integer, ResY As Integer ResX = Screen.Width / Screen.TwipsPerPixelX ResY = Screen.Height / Screen.TwipsPerPixelY MsgBox "La resolution est de " & ResX & "x" & ResY & "px"
Rq: si on ne divise pas par Screen.TwipsPerPixelX/Y on obtient la résolution en Twips.
-- Nicolas G. FAQ VB : http://faq.vb.free.fr API Guide : http://www.allapi.net Google Groups : http://groups.google.fr/ MZ-Tools : http://www.mztools.com/
"Patrick FREDIN" a écrit dans le message de news: uEUPM7#
Bonjour,
Comment puis-je connaître la résolution de écran ? Je voudrais utiliser ce résultat pour redimensionner des fenêtres.
Merci pour votre aide.
-- Patrick
Salut,
Tu peux obtenir la résolution en pixel très simplement grace a l'objet
Screen :
Dim ResX As Integer, ResY As Integer
ResX = Screen.Width / Screen.TwipsPerPixelX
ResY = Screen.Height / Screen.TwipsPerPixelY
MsgBox "La resolution est de " & ResX & "x" & ResY & "px"
Rq: si on ne divise pas par Screen.TwipsPerPixelX/Y on obtient la résolution
en Twips.
--
Nicolas G.
FAQ VB : http://faq.vb.free.fr
API Guide : http://www.allapi.net
Google Groups : http://groups.google.fr/
MZ-Tools : http://www.mztools.com/
"Patrick FREDIN" <nospams_fredin@magic.fr> a écrit dans le message de news:
uEUPM7#7DHA.712@tk2msftngp13.phx.gbl...
Bonjour,
Comment puis-je connaître la résolution de écran ?
Je voudrais utiliser ce résultat pour redimensionner des fenêtres.
Tu peux obtenir la résolution en pixel très simplement grace a l'objet Screen :
Dim ResX As Integer, ResY As Integer ResX = Screen.Width / Screen.TwipsPerPixelX ResY = Screen.Height / Screen.TwipsPerPixelY MsgBox "La resolution est de " & ResX & "x" & ResY & "px"
Rq: si on ne divise pas par Screen.TwipsPerPixelX/Y on obtient la résolution en Twips.
-- Nicolas G. FAQ VB : http://faq.vb.free.fr API Guide : http://www.allapi.net Google Groups : http://groups.google.fr/ MZ-Tools : http://www.mztools.com/
"Patrick FREDIN" a écrit dans le message de news: uEUPM7#
Bonjour,
Comment puis-je connaître la résolution de écran ? Je voudrais utiliser ce résultat pour redimensionner des fenêtres.