| | |
How to detect Screen Resolution in VB6 ?
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
![]() |
Hi,
You dont need an API to know the Resolution.., Use Screen Object of VB:
Regards
Veena
You dont need an API to know the Resolution.., Use Screen Object of VB:
vb Syntax (Toggle Plain Text)
msgbox "Width = " & Screen.Width/15 _ & vbcrlf _ & " Height = " & Screen.Height/15
Regards
Veena
Last edited by QVeen72; Nov 7th, 2007 at 5:55 am.
•
•
Join Date: Feb 2008
Posts: 3
Reputation:
Solved Threads: 0
I have the same issue. What I want to detect is the actual operating system under the control panel and detect that windows settings so that I can tell the user change the resolution. The screen method does not seem to work well. i have tested my code where I changed the resolution to a lower resolution, and someone made the comment the program looks crappy!
I agree. There's got to be a way to detect under start->Control Panel->Display->Settings-> screen Resolution Slide bar.
The specific question is how to fetch that resolution and evaluate it in your code? The dumb way would be to have a dialog box and tell the user to change it, but more elegant would be a way to detect it.
Does anyone know how to do this? There's got to be an API to acces that in the OS.
Regards,
Rj
I agree. There's got to be a way to detect under start->Control Panel->Display->Settings-> screen Resolution Slide bar.
The specific question is how to fetch that resolution and evaluate it in your code? The dumb way would be to have a dialog box and tell the user to change it, but more elegant would be a way to detect it.
Does anyone know how to do this? There's got to be an API to acces that in the OS.
Regards,
Rj
•
•
Join Date: Feb 2008
Posts: 3
Reputation:
Solved Threads: 0
The answer to everyone's request is here. I knew there was an API out there to do so. this website has it http://cuinl.tripod.com/Tips/get_scr...olutionAPI.htm
1. Download the API-GUIDE. Neat utility for all windows API and sample code. google it
http://www.devhood.com/Tools/tool_de...px?tool_id=563
Make a module and dump this code
Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
Public Const SM_CXSCREEN = 0
Public Const SM_CYSCREEN = 1
Make a form and dump it on the Form_Load() procedure.
Private Sub Form_Load()
Dim Tmp As String
Tmp = GetSystemMetrics(SM_CXSCREEN) & _
"x" & GetSystemMetrics(SM_CYSCREEN)
MsgBox (Tmp)
End Sub
You will see that you can get the information you need.
RJ
1. Download the API-GUIDE. Neat utility for all windows API and sample code. google it
http://www.devhood.com/Tools/tool_de...px?tool_id=563
Make a module and dump this code
Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
Public Const SM_CXSCREEN = 0
Public Const SM_CYSCREEN = 1
Make a form and dump it on the Form_Load() procedure.
Private Sub Form_Load()
Dim Tmp As String
Tmp = GetSystemMetrics(SM_CXSCREEN) & _
"x" & GetSystemMetrics(SM_CYSCREEN)
MsgBox (Tmp)
End Sub
You will see that you can get the information you need.
RJ
Last edited by rjrodrig; Feb 4th, 2008 at 11:11 pm. Reason: quoting web
•
•
Join Date: May 2009
Posts: 2
Reputation:
Solved Threads: 0
yes I believe i ve tried using the code already ====
====
all you really need is to discover controls in Visual Basic..
heres the code ive used:
i used it in the module so that i could easily call it:
Public Function ScreenResolution(f As Form) As String
Dim iWidth As Integer, iHeight As Integer
iWidth = Screen.Width \ Screen.TwipsPerPixelX
iHeight = Screen.Height \ Screen.TwipsPerPixelY
ScreenRes = iWidth & " X " & iHeight
End Function
gr3en39@gmail.com
====
all you really need is to discover controls in Visual Basic..
heres the code ive used:
i used it in the module so that i could easily call it:
Public Function ScreenResolution(f As Form) As String
Dim iWidth As Integer, iHeight As Integer
iWidth = Screen.Width \ Screen.TwipsPerPixelX
iHeight = Screen.Height \ Screen.TwipsPerPixelY
ScreenRes = iWidth & " X " & iHeight
End Function
gr3en39@gmail.com
![]() |
Similar Threads
- Making Webpages that conform to the users resolution (Site Layout and Usability)
- Website view on different Screen Resolution ??? (Site Layout and Usability)
- Screen Resolution in KDE (*nix Software)
- Screen Resolution Help! (Windows NT / 2000 / XP)
- Screen Resolution prob (Windows NT / 2000 / XP)
- Screen resolution problems in mandrake/KDE (Window and Desktop Managers)
- For marcus1060: Screen resolution problems in mandrake/KDE (Window and Desktop Managers)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Checking and UnChecking a CheckListBox
- Next Thread: Password
Views: 7302 | Replies: 10
| Thread Tools | Search this Thread |
Tag cloud for Visual Basic 4 / 5 / 6
* 6 429 2007 access activex add age append application basic beginner birth bmp c++ calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver struct subroutine table tags textbox time timer urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





