473,473 Members | 2,138 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Change Screen Resolution using VB

I need some help with some VB language that will change the screen
resolution on a monitor when a MS-Access 2000 database is opened from
1024 x 768 to 800 x 600.
Any help with this effort would be deeply appreciated.
Thanks in advance....
Nov 13 '05 #1
4 15477
If your program changed the resolution setting of _my_ monitor, it would
only do so once, because I'd never run it again. It is entirely possible
that there is a Windows API could be used to do what you want -- if I knew
what it was, though, I wouldn't contribute to such a practice.

What did you have in mind for notebooks whose LCD screen is only really
useful at whatever its native setting is, which may well not be 800x600 --
my notebook's native setting is 1024x768.

Larry Linson
Microsoft Access MVP

"pjac" <pj**@erols.com> wrote in message
news:94**************************@posting.google.c om...
I need some help with some VB language that will change the screen
resolution on a monitor when a MS-Access 2000 database is opened from
1024 x 768 to 800 x 600.
Any help with this effort would be deeply appreciated.
Thanks in advance....

Nov 13 '05 #2
I don't know about changing the screen resolution, but there are
third-party form scaling solutions available that might help:

A shareware version of a form rescaling module I wrote called
ShrinkerStretcher is available at this web site:
http://www.peterssoftware.com/ss.htm

FMS has a sizer module at www.fmsinc.com.

The Access Developer's Handbook has form resizing code included:
http://www.amazon.com/exec/obidos/IS...064361-7403703

For more informmation, there are some great articles about form
scaling in the December 2000, and May 2001 SmartAccess newsletter.
Check it out here: http://www.smartaccessnewsletter.com

Hope this helps,

Peter De Baets
Peter's Software - MS Access Tools for Developers
http://www.peterssoftware.com

pj**@erols.com (pjac) wrote in message news:<94**************************@posting.google. com>...
I need some help with some VB language that will change the screen
resolution on a monitor when a MS-Access 2000 database is opened from
1024 x 768 to 800 x 600.
Any help with this effort would be deeply appreciated.
Thanks in advance....

Nov 13 '05 #3
"pjac" <pj**@erols.com> wrote in message
news:94**************************@posting.google.c om...
I need some help with some VB language that will change the screen
resolution on a monitor when a MS-Access 2000 database is opened from
1024 x 768 to 800 x 600.
Any help with this effort would be deeply appreciated.
Thanks in advance....


From a previous post by Arvin Meyer:

'************************************************* ****************
' DECLARATIONS SECTION
'************************************************* ****************

Option Compare Database
Option Explicit

Type RECT
x1 As Long
y1 As Long
x2 As Long
y2 As Long
End Type

' NOTE: The following declare statements are case sensitive.

Declare Function GetDesktopWindow Lib "User32" () As Long
Declare Function GetWindowRect Lib "User32" _
(ByVal hWnd As Long, rectangle As RECT) As Long
'================================================= =====

'This code shows how to change the screen resolution.

'Call the function like this:

' ChangeResolution 640, 480

'This would change the screen resolution to 640 pixels x 480 pixels. Note
that
'you can only change the resolution to values supported by the display.

'Paste the following code into a module:'

Private Declare Function ChangeDisplaySettings Lib "User32" Alias _
"ChangeDisplaySettingsA" (lpDevMode As Any, ByVal dwFlags As Long) As Long
Private Declare Function EnumDisplaySettings Lib "User32" Alias _
"EnumDisplaySettingsA" (ByVal lpszDeviceName As Long, ByVal iModeNum As _
Long, lpDevMode As Any) As Boolean

Const DM_PELSWIDTH = &H80000
Const DM_PELSHEIGHT = &H100000
Const CCFORMNAME = 32
Const CCDEVICENAME = 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

Public Function Change_Resolution(iWidth As Single, iHeight As Single)

Dim DevM As DEVMODE
Dim a As Boolean
Dim i As Long
Dim b As Long

i = 0

'Enumerate settings
Do
a = EnumDisplaySettings(0&, i&, DevM)
i = i + 1
Loop Until (a = False)

'Change settings
DevM.dmFields = DM_PELSWIDTH Or DM_PELSHEIGHT

DevM.dmPelsWidth = iWidth
DevM.dmPelsHeight = iHeight

b = ChangeDisplaySettings(DevM, 0)

End Function

'************************************************* ****************
' FUNCTION: GetScreenResolution()
'
' PURPOSE:
' To determine the current screen size or resolution.
'
' RETURN:
' The current screen resolution. Typically one of the following:
' 640 x 480
' 800 x 600
' 1024 x 768
'
'************************************************* ****************
Function GetScreenResolution() As String

Dim R As RECT
Dim hWnd As Long
Dim RetVal As Long

hWnd = GetDesktopWindow()
RetVal = GetWindowRect(hWnd, R)
GetScreenResolution = (R.x2 - R.x1) & "x" & (R.y2 - R.y1)

End Function
Nov 13 '05 #4
Thanks to all who responded!! Especially John W. Very helpful!!!!!
Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Erik Bethke | last post by:
Hello All, I am trying to clean up some polish bugs with the Shanghai game I am working on and I am currently stuck on trying to get the right event for detecting when the user has changed the...
1
by: Erik Bethke | last post by:
Hello All, I am trying to clean up some polish bugs with the Shanghai game I am working on and I am currently stuck on trying to get the right event for detecting when the user has changed the...
27
by: skeeterbug | last post by:
please see http://www.geocities.com/operationsengineer1/test.htm for an idea of how i want my logo header div to be layed out. when i went to resize "Test" to 2em (from 1em), this is what...
5
by: Chris | last post by:
After exhausting my search on the MS website, I can't find a straight answer. I fin dit hard to believe that MS left our something so useful in ASP.NET as screen resolution detection. Problem:...
8
by: lauren quantrell | last post by:
Is there a way to force a change in a user's screen resolution using VBA code without having any input from the user? Example: User John Backwards has his screen set to 800 x 600 pixels. Backwards...
1
by: Bertrand1978 | last post by:
Hi All. I am using VC++/Visual Studio 6.0. I can get the current screen resolution with GetSystemMetrics(), but how do you change the screen resolution ? I guess I couldn't find a...
7
by: Tim Rogers | last post by:
Hi folks, this is a resolution-detect script that I used on a site. As you can see it is designed to detect when the screen resolution falls below a certain level then load an alternative style...
9
by: Steve Wright | last post by:
Hi I'm developing a webpage that needs to include a different stylesheet depending on the screen resolution. I know that I could read the resolution in javascript and then do some sort of...
1
by: Tea Maker | last post by:
Hi, I have an application that is best viewed at 1024x768. I know that changing the screen resolution might cause some problems, but it's very important that I go on with this. So my plan is,...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.