Results 1 to 4 of 4

Thread: [RESOLVED] desktop background

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Resolved [RESOLVED] desktop background

    is it possible to change the desktops background with vb6, and how?

  2. #2
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: desktop background

    Happy B'Day

    Two beautiful ways to achieve what you want...

    http://www.freevbcode.com/ShowCode.asp?ID=5489
    http://www.vb-helper.com/howto_backer.html
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  3. #3
    Addicted Member pcuser's Avatar
    Join Date
    Jun 2008
    Posts
    219

    Re: desktop background

    You can use the SystemParametersInfo API function. The first parameter is set to 20, the second parameter is set to 0, the third parameter is the path and filename of your bitmap image and the final parameter is set to 0 if you don't want the changes to survive a reboot and 1 if you do.

    Code:
    Private Declare Function SystemParametersInfo Lib "user32" _
        Alias "SystemParametersInfoA" _
        (ByVal uAction As Long, _
        ByVal uParam As Long, _
        ByVal lpvParam As String, _
        ByVal fuWinIni As Long) As Long
    
    
    Private Sub ChangeWallpaper(BMPfilename As String, UpdateRegistry As Boolean)
        On Error GoTo MyErr
        If UpdateRegistry Then
            SystemParametersInfo 20, 0, BMPfilename, 1
        Else
            SystemParametersInfo 20, 0, BMPfilename, 0
        End If
        Exit Sub
    MyErr:
        MsgBox "oops... " & Err.Description
    End Sub
    
    
    Private Sub Command1_Click()
        ' This won't survive a reboot
        ChangeWallpaper App.Path & "\wallpaper.bmp", False
    End Sub
    
    Private Sub Command2_Click()
        ' This will permanently change the wallpaper
        ChangeWallpaper App.Path & "\wallpaper.bmp", True
    End Sub

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Re: desktop background

    i like how you can choose wether it should be permenant or not thanks works.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width