Newsgroup: it.comp.appl.access
Titolo: Risoluzione su apertura maschera.

Salve a tutto il Ng,
vorrei sapere come fare, su apertura di una maschera, ad impostare la
risoluzione video a 1024*768, e reimpostarla a 800*600 alla chiusura della
stessa.
Grazie
Lucio

"Lucio" <nap...@NOSPAMtin.it> ha scritto nel messaggio
news:pq08c.114171$O31.4...@news4.tin.it...

Metti in un modulo questo codice fa esattatente quello che chiedi, in realtà
qualche cosa di meglio la forza a 1024x768 solo se non lo è già e alla
chiusura
la riporta come all'inizio le 2 funzioni da richiamare sono queste:
All'apertura di Access possibiltmente con la Macro AUTOEXEC lanci
la funzione ------>StartUp()
Alla chiusura di Access lanci ------->SetOldRes()
Ciao
@Alex.
'***************************************************************************
***********************
Option Compare Database
Option Explicit
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 Const CCDEVICENAME = 32
Private Const CCFORMNAME = 32
Private Const DM_PELSWIDTH = &H80000
Private Const DM_PELSHEIGHT = &H100000
Public Const DISP_CHANGE_SUCCESSFUL = 0
Public Const DISP_CHANGE_RESTART = 1
Public Const ENUM_CURRENT_SETTINGS = -1
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 flChangeRes as Boolean
Public HoldX as Long
Public HoldY as Long
Private Function ChangeRes(Optional ByVal x As Single = 1024, Optional ByVal
Y As Single = 768) As Boolean
Dim DevM As DevMode
Dim A As Boolean
Dim I&
Dim B&
    ChangeRes = False
    DevM.dmFields = DM_PELSWIDTH Or DM_PELSHEIGHT
    DevM.dmSize = LenB(DevM)
    Call EnumDisplaySettings(0&, ENUM_CURRENT_SETTINGS, DevM)
    HoldX = DevM.dmPelsWidth
    HoldY = DevM.dmPelsHeight
    If HoldX <> x Then
        I = 0
        Do
            A = EnumDisplaySettings(0&, I&, DevM)
            I = I + 1
        Loop Until (A = False)
        DevM.dmFields = DM_PELSWIDTH Or DM_PELSHEIGHT
        DevM.dmPelsWidth = x
        DevM.dmPelsHeight = Y
        ChangeRes = ChangeDisplaySettings(DevM, 1)
        ChangeRes = True
    End If
End Function
Public Sub SetOldRes()
    If flChangeRes Then ChangeRes HoldX, HoldY
End Sub
Public Function StartUp()
    flChangeRes = ChangeRes(1024, 768)
End Function