Newsgroup: it.comp.lang.visual-basic
Titolo: Aumentare la risoluzione se minore di 1024x768

Esistono delle api che fanno tale cosa???
x ora riesco solo a carpire se la risoluzione e' minore o maggiore di
1024x768 ma se fosse minore come la ingrandisco??? e quando chiudo il
programma a rendere la risoluzione come era prima???
grazie!

 ha scritto nel messaggio
news:8thA8.48354$W9.11...@twister2.libero.it...

Const DISP_CHANGE_SUCCESSFUL = 0
Const DISP_CHANGE_RESTART = 1
Const DISP_CHANGE_FAILED = -1
Const DISP_CHANGE_BADMODE = -2
Const DISP_CHANGE_NOTUPDATED = -3
Const DISP_CHANGE_BADFLAGS = -4
Const DISP_CHANGE_BADPARAM = -5
Const CDS_UPDATEREGISTRY = &H1
Const CDS_TEST = &H2
Private Declare Function EnumDisplaySettings Lib "user32.dll" _
    Alias "EnumDisplaySettingsA" (ByVal lpszDeviceName As String, _
    ByVal iModeNum As Long, lpDevMode As DEVMODE) As Long
Private Declare Function ChangeDisplaySettings Lib "user32" _
    Alias "ChangeDisplaySettingsA" (lpDevMode As Any, _
    ByVal dwflags As Long) As Long
Private Type DEVMODE
    dmDeviceName As String * 32
    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 * 32
    dmUnusedPadding As Integer
    dmBitsPerPixel As Integer
    dmPelsWidth As Long
    dmPelsHeight As Long
    dmDisplayFlags As Long
    dmDisplayFrequency As Long
    ' The following only appear in Windows 95, 98, 2000
    dmICMMethod As Long
    dmICMIntent As Long
    dmMediaType As Long
    dmDitherType As Long
    dmReserved1 As Long
    dmReserved2 As Long
    ' The following only appear in Windows 2000
    dmPanningWidth As Long
    dmPanningHeight As Long
End Type
Private CurrentCfg As DEVMODE
'Salva la configurazione corrente
'Ritorna True se ha salvato la configurazione corrente
Public Function SaveCurrentDisplayMode() As Boolean
    CurrentCfg.dmSize = Len(CurrentCfg)
    SaveCurrentDisplayMode = (EnumDisplaySettings(vbNullString, _
        ENUM_CURRENT_SETTINGS, CurrentCfg) <> DISP_CHANGE_SUCCESSFUL)
End Function
'Carica la configurazione precedente
'Ritorna uno dei seguenti valori:
'  0 Risoluzione modificata con successo
'  1 Occorre riavviare il computer
' -1 Modifica risoluzione fallita
' -2 Modalità non consentita
' -3 Impossibile aggiornare il registro (Windows NT)
' -4 Flag errato
' -5 Parametro errato
Public Function RestoreDisplayMode() As Long
    RestoreDisplayMode = ChangeDisplaySettings(CurrentCfg, CDS_UPDATEREGISTRY)
End Function
Public Function ChangeDisplayMode(lngWidth As Long, _
    lngHeight As Long, lngBitsPerPixel As Long, _
    lngFrequency As Long)
    Dim CDM As DEVMODE
    CDM.dmSize = Len(CDM)
    if EnumDisplaySettings(vbNullString, _
        ENUM_CURRENT_SETTINGS, CDM) <> 0 Then
        CDM.dmPelsWidth = lngWidth
        CDM.dmPelsHeight = lngHeight
        CDM.dmBitsPerPixel = lngBitsPerPixel
        CDM.dmDisplayFrequency = lngFrequency
        If ChangeDisplaySettings(devM, CDS_TEST) = DISP_CHANGE_SUCCESSFUL Then
            ChangeDisplayMode = ChangeDisplaySettings(CDM, CDS_UPDATEREGISTRY)
        Else
            ChangeDisplayMode = DISP_CHANGE_FAILED
        End If
    Else
        ChangeDisplayMode = DISP_CHANGE_FAILED
    End If
End Function
Ciao!
--
Esteban
Hosted by 
www.seber.it
(Remove nonspammare for reply)