Can I change screen size from 800x600 to 1024x768 in VB ?


Posted by Mark Henry on February 06, 2002 5:27 PM

Can I change screen size from 800x600 to 1024x768 in a VB command ?

Posted by Ivan F Moala on February 06, 2002 5:57 PM

Yes you can ...try this;

Declare Function GetSystemMetrics Lib "user32.dll" (ByVal nIndex As Long) As Long
Const SM_CXSCREEN = 0
Const SM_CYSCREEN = 1

Sub GetScreenSize()
Dim x As Long, y As Long, sYourMessage, iConfirm As Integer
x = GetSystemMetrics(SM_CXSCREEN)
y = GetSystemMetrics(SM_CYSCREEN)
'If x < 1024 And y < 768 Then
sYourMessage = "Current screen size is " & x & " x " & y & vbCrLf
sYourMessage = sYourMessage & "This screen is best viewed at 1024 x 768." & vbCrLf
sYourMessage = sYourMessage & "Would you like to change the resolution?"
iConfirm = MsgBox(sYourMessage, vbExclamation + vbYesNo, "Screen Resolution")
If iConfirm = vbYes Then
'Change screen settings
Call Shell("rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,3")
End If
'End If
End Sub

HTH

Ivan



Posted by Mark Henry on February 08, 2002 4:25 PM

excellent Thank you very much I will try it tonight