Screen Resolution

Can someone brief me with the code that helps to adjust the screen resolution of the program according to the windows resolution? For example if the windows resolution is 1027 X 768 then the program should also use this resolution.

The 2 constants represent the screen sizes used when the app was developed.
When your form(s) load you can pass the controls in which you want resized
to the ResizeControl sub procedure and the controls which also have a font
which need resizing to the ResizeFont sub procedure. Not all controls will
need to be resized when the screen size changes and not all of the controls
will have a font size or a font size you want changed. The ResizeFont sub
would mainly be for buttons and labels persay that you still want your users
to be able to read if the control became to small to fit the entire caption
onto. You could also a Microsoft control call SYSINFO.ocx, should be located
in your System32 folder, that has an event that will fire when the screen
resolution changes. You could use this control to resize your controls if
the user changes resolutions while your application is running.

Siraj,
My attitude is to keep it simple.
If you develop a program for a business you could ask whether all the users can run at 1024 * 768
If you cannot control who uses it, you could develop it at 800 * 600
When people are running at higher resolutions they can live with programs that do not fill their screen.

Himadri,
You should start a fresh thread, so you don't irritate the original poster of this thread.
I have XP Pro, and it does not require rebooting, when I change resolution.
If you mention your o/s (eg W 98 SE), someone who uses that can respond.
Happy New Year,
Rob

Sorry
this is the whole story
you need a module and an opening form
the code
opening form
Dim PARAA, PARAB As Integer
Private Sub Newresolution()
Dim typDevM As typDevMODE
Dim lngResult As Long
Dim intAns

As Integer
'PARAA = 800
'PARAB = 600
' Retrieve info about the current graphics mode
' on the current display device.
lngResult = EnumDisplaySettings(0, 0, typDevM)
' Set the new resolution. Don't change the color
' depth so a restart is not necessary.
With typDevM

dmDisplayFrequency As Long
End Type
Public Declare Function EnumDisplaySettings Lib "user32" Alias
"EnumDisplaySettingsA" (ByVal lpszDeviceName As Long, ByVal iModeNum As
Long, lpDevMode As Any) As Boolean
Public Declare Function ChangeDisplaySettings Lib "user32" Alias
"ChangeDisplaySettingsA" (lpDevMode As Any, ByVal dwFlags As Long) As Long
Public Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long,
ByVal dwReserved As Long) As Long
Public Declare Function GetDeviceCaps Lib "gdi32" (ByVal hdc As Long, ByVal
nIndex As Long) As Long
Public Declare Function CreateDC Lib "gdi32" Alias "CreateDCA" (ByVal
lpDriverName As String, ByVal lpDeviceName As String, ByVal lpOutput As
String, ByVal lpInitData As Any) As Long
Public Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal
hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As
Long
Public OldX As Long
Public OldY As Long
Public nDC As Long
Public Sub ChangeRes(x As Long, y As Long, Bits As Long)

On Error GoTo ChangeRes_Err
Dim DevM As DEVMODE, ScInfo As Long, erg As Long, an As VbMsgBoxResult

> Code to change user's Screen Resolution
> WITHOUT rebooting.
You need to check the return value from the call to ChangeDisplaySettings to see if you were able to do it without rebooting. I'm not sure you can always do this for every system without a reboot.
Rod
Rod Stephens, Visual Basic MVP
*** New Book ***
Visual Basic 2008 Programmer's Reference
http://www.amazon.com/exec/obidos/ASIN/0470182628/ vbhelper/