PDA

Vollständige Version anzeigen : Systemauflösung ermitteln . . .


Scotty
29.09.2003, 13:38
Hallo Leute ...

wie kann ich mit VBA, die Systemauflösung ermitteln.

Gruß

Scotty

MRR
29.09.2003, 13:52
Hi Scotty,
wenn DU mal "googlest", stößt Du bestimmt auch auf folgende Links:
http://www.chf-online.de/vba/aufloesungswechsel.htm
************************************153/article984746.html
Oder auch von Hans Herber:

Declare Function GetDeviceCaps Lib "gdi32" (ByVal hdc As Long, _
ByVal nIndex As Long) As Long
Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, _
ByVal hdc As Long) As Long

Const HORZRES = 8
Const VERTRES = 10

Function ScreenResolution()
Dim lRval As Long
Dim lDc As Long
Dim lHSize As Long
Dim lVSize As Long
lDc = GetDC(0&)
lHSize = GetDeviceCaps(lDc, HORZRES)
lVSize = GetDeviceCaps(lDc, VERTRES)
lRval = ReleaseDC(0, lDc)
ScreenResolution = lHSize & "x" & lVSize
End Function

Sub DialogAufruf()
frmFullSize.Show
End Sub

In der Userform:
Private Sub CommandButton1_Click()
Unload Me
End Sub

Private Sub UserForm_Initialize()
Dim strSize As String
strSize = ScreenResolution
With Me
.Width = Left(strSize, InStr(strSize, "x") - 1)
.Height = Right(strSize, Len(strSize) - _
InStr(strSize, "x"))
.Left = 0
.Top = 0
End With
End Sub

Usw. usf.