|
-
Sep 12th, 2006, 06:53 AM
#1
[RESOLVED] Screen Resolution
Dear Team.
My Program will work Effectively in 1024*768.Now I want to check wheather the this computer supports this screen resolution and supports 32 bit also.How can I ?
Last edited by danasegarane; Sep 12th, 2006 at 07:02 AM.
-
Sep 12th, 2006, 07:12 AM
#2
Re: Screen Resolution
is your program a game?
if not then make sure your app supports their resolution - not the other way round...
-
Sep 12th, 2006, 08:03 AM
#3
Re: Screen Resolution
MY Program is not a game.I want to check the resollution .If the machine doesn't support the 1024*768, i have to end the program.How can I check the screen resolution.
-
Sep 12th, 2006, 08:07 AM
#4
Re: Screen Resolution
there are several ways - here's just one:
VB Code:
Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
Private Const SM_CXSCREEN = 0
Private Const SM_CYSCREEN = 1
Private Sub Command1_Click()
Debug.Print GetSystemMetrics(SM_CXSCREEN) & " x " & GetSystemMetrics(SM_CYSCREEN)
End Sub
-
Sep 12th, 2006, 08:10 AM
#5
Re: Screen Resolution
Dear Bushmobile.
Thanks for the post.Will is return only 1024*768 or some other.
-
Sep 12th, 2006, 08:11 AM
#6
Re: Screen Resolution
it returns the screen width & height in Pixels
-
Sep 12th, 2006, 08:12 AM
#7
Re: Screen Resolution
Will it return only 1024 * 768 or some other display modes? or 800*600 also.
-
Sep 12th, 2006, 08:19 AM
#8
Re: Screen Resolution
if the screen's width is 800 and it's height in 600 then it will return 800 x 600.
resolution is just the number of pixels that are on the screen
-
Sep 12th, 2006, 08:25 AM
#9
Re: Screen Resolution
Please explain how to loop through the Resolution schme and check for the 1024*768 mode.Thanks in advance.
-
Sep 12th, 2006, 08:35 AM
#10
Re: Screen Resolution
VB Code:
Option Explicit
Const ENUM_CURRENT_SETTINGS As Long = -1&
Const CCDEVICENAME = 32
Const CCFORMNAME = 32
Private Type DEVMODE
dmDeviceName As String * CCDEVICENAME
dmSpecVersion As Integer
dmDriverVersion As Integer
dmSize As Integer
dmDriverExtra As Integer
dmFields As Long
dmOrientation As Integer
dmPaperSize As Integer
dmPaperLength As Integer
dmPaperWidth As Integer
dmScale As Integer
dmCopies As Integer
dmDefaultSource As Integer
dmPrintQuality As Integer
dmColor As Integer
dmDuplex As Integer
dmYResolution As Integer
dmTTOption As Integer
dmCollate As Integer
dmFormName As String * CCFORMNAME
dmUnusedPadding As Integer
dmBitsPerPel As Integer
dmPelsWidth As Long
dmPelsHeight As Long
dmDisplayFlags As Long
dmDisplayFrequency As Long
End Type
Private Declare Function EnumDisplaySettings Lib "user32" Alias "EnumDisplaySettingsA" ( _
ByVal lpszDeviceName As Long, ByVal iModeNum As Long, lpDevMode As Any) As Boolean
Private Sub Command1_Click()
Dim DevM As DEVMODE, lEnum As Long
EnumDisplaySettings 0&, ENUM_CURRENT_SETTINGS, DevM
Debug.Print "Currently: " & DevM.dmPelsWidth; " x " & DevM.dmPelsHeight & " at " & DevM.dmBitsPerPel & " bits/pixel"
Debug.Print vbCrLf & "Available:"
Do While EnumDisplaySettings(0&, lEnum, DevM)
Debug.Print DevM.dmPelsWidth & " x " & DevM.dmPelsHeight & " at " & DevM.dmBitsPerPel & " bits/pixel"
lEnum = lEnum + 1
Loop
End Sub
based on the example at AllAPI.net
why do you need to bother tho - check if the resolution isn't the same as your ideal using the code in post #4 and then flash up a msgBox saying "best viewed in X by Y"
-
Sep 12th, 2006, 08:40 AM
#11
Re: Screen Resolution
I am doing for Internet Explore viewing.I have to restrict to user to 1024*768.So only i need to end my application if the system doesn't support that resolution
-
Sep 12th, 2006, 08:43 AM
#12
Re: Screen Resolution
Thanks Bushmobile,
Its working.Can you help me in getting the bit format of the system like 32 bit , 16 bit or 64 bit?
-
Sep 12th, 2006, 08:53 AM
#13
Re: Screen Resolution
i dunno, i guess you'd have to work it out from the OS Version
-
Sep 12th, 2006, 08:59 AM
#14
Re: Screen Resolution
That doen't give the bit size?
-
Sep 12th, 2006, 09:41 AM
#15
Re: Screen Resolution
nope - it gives you OS version, from which you can derive the bit-version
i'm not sure if you can just get the bit-version - perhaps start a new thread (people will be more likely to look at it).
Are you sure you mean the bit-version of the system and not the screen bit depth?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|