Solved

Video risolution

Posted on 2004-04-28
6
196 Views
Last Modified: 2011-09-20
Hi,
Is it possible from within VisualBasic (particulary from VBApplication in Access) to change the screen-resolution?
Example: from 800x600 to 1024x768  and viceversa?
Thanks in advance.
0
Comment
Question by:Alexius71
  • 3
  • 2
6 Comments
 
LVL 24

Expert Comment

by:R_Rajesh
ID: 10944335
0
 
LVL 24

Expert Comment

by:R_Rajesh
ID: 10944355
to be exact this should have been the link:
http://www.mentalis.org/apilist/ChangeDisplaySettings.shtml
0
 
LVL 19

Expert Comment

by:RanjeetRain
ID: 10949660
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 19

Expert Comment

by:RanjeetRain
ID: 10949685
Thats a ***** rated ActiveX control developed by me that can also be found here: http://www.topshareware.com/Display-Mode-Manager-download-11495.htm

~ Ranjeet Rain
0
 

Expert Comment

by:IAmAnExpert
ID: 10957152
Hi,

Paste the code below into a Form, Class or Module and use the defined sub ChangeRes to change the resolution.

*
Option Explicit

Private Const CCDEVICENAME = 32
Private Const CCFORMNAME = 32
Private Const DM_PELSWIDTH = &H80000
Private Const DM_PELSHEIGHT = &H100000

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

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 Sub ChangeRes(iWidth As Single, iHeight As Single)
    Dim blnWorked As Boolean
    Dim i As Long
    Dim DevM As DEVMODE
   
    i = 0
   
    Do
        blnWorked = EnumDisplaySettings(0&, i, DevM)
        i = i + 1
    Loop Until (blnWorked = False)
       
    With DevM
        .dmFields = DM_PELSWIDTH Or DM_PELSHEIGHT
        .dmPelsWidth = iWidth
        .dmPelsHeight = iHeight
    End With
   
    Call ChangeDisplaySettings(DevM, 0)
End Sub
*
0
 
LVL 19

Accepted Solution

by:
RanjeetRain earned 125 total points
ID: 10963932
IAmAnExpert,

your code will fail in case the attempted resolution is not supported. My ActiveX control includes error testing. It allows you to test whther a video mode is even supported or not. It even includes control over horizontal scan rate of video.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now