·  Start ·  Programme ·  Codes ·  Tipps ·  ActiveX ·  Tutorials · 



Für diesen Tip brauchen Sie nur eine Form, einen CommandButton (Command1) und ein CommonDialogControl. Sie können das Beispiel leicht ausbauen, um vorhandene Bilder bei jedem Start oder jeden Tag als Hintergrund anzuzeigen.

Private Const SPI_SETDESKWALLPAPER = 20
Private Const SPIF_UPDATEINIFILE = &H1
Private Const SPIF_SENDWININICHANGE = &H2
Private Declare Function SystemParametersInfo Lib "user32" Alias _
"SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, _
ByVal lpvParam As Any, ByVal fuWinIni As Long) As Long 

Private Sub Command1_Click()
Dim rSuccess As Long 
 
    On Error Resume Next 
 
    With CommonDialog1
        .DialogTitle = "Hintergrundbild auswechseln"
        .Filter = "Bitmap-Dateien (*.bmp)|*.bmp"
        .FileName = ""
        .FilterIndex = 1
        .CancelError = True 
        .ShowOpen
        If Err = 0 Then 
            rSuccess = SystemParametersInfo(SPI_SETDESKWALLPAPER, 0&, .FileName, _
                                            SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE)
            If rSuccess = 1 Then 
                MsgBox "Hintergrundbild ausgewechselt.", vbOKOnly, Command1.Caption
            End If 
        End If 
    End With 
End Sub
Aktualisiert: 12.02.2008, 14:11 Uhr Copyright © 2001 - 2010 by ST-software Navigation zurück  |  Navigation vorwärts  |  Zum Seitenanfang     
Ihre IP: 38.107.191.82 ·  Seite erstellt in: 0.307 Sekunden ·  Dateigröße:  3195 Bytes