Results 1 to 5 of 5

Thread: [RESOLVED] How To Change Desktop Background Using jpg Image

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2009
    Location
    IRaQ / BaghDaD
    Posts
    192

    Resolved [RESOLVED] How To Change Desktop Background Using jpg Image

    hi

    how to change desktop back using jpg

    i got vb code to change it but Accept just bmp

    this is the code


    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 Const SPI_SETDESKWALLPAPER = 20
    Private Const SPIF_UPDATEINIFILE = &H1
        
    
    Private imagePath As String
        
    Private Sub cmdBrowse_Click()
    
            
        'set a custom title to the dialog
        dlg.DialogTitle = "Select the image to load."
    
        'show the dialog
        dlg.ShowOpen
    
        'the path to get the image from
        imagePath = dlg.FileName
    
        'view the selected picture into the picturebox
        'control
        pic.Picture = LoadPicture(imagePath)
            
    End Sub
    
    Private Sub cmdSetWallPaper_Click()
    
        SystemParametersInfo SPI_SETDESKWALLPAPER, 0, imagePath, SPIF_UPDATEINIFILE
    
    End Sub
    and i want it to change the background and Accept the both type of image

    BMP & JPG

    Last edited by DeadlyMan; Dec 15th, 2009 at 12:11 PM.

  2. #2
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228

    Re: How To Change Desktop Background Using jpg Image

    You could convert the jpg to a bmp in your code.

    vb Code:
    1. 'Code Not tested by me.
    2. If Right$(imagePath, 3) = "jpg" Or Right$(imagePath, 3) = "JPG" Or Right$(imagePath, 3) = _
    3.       "gif" Or Right$(imagePath, 3) = "GIF" Then
    4.             pic.Picture = LoadPicture(imagePath)
    5.             SavePicture pic, App.path & "\wallpaper.bmp"
    6. End If
    Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
    save a blobFileStreamDataTable To Text Filemy blog

  3. #3
    Addicted Member
    Join Date
    Feb 2008
    Location
    XP & Vista
    Posts
    181

    Re: How To Change Desktop Background Using jpg Image

    Take a look this article :
    Code:
    http://support.microsoft.com/kb/313596
    _____________________________________________
    Regrads,
    kpmsivachand

    Don't walk in front of me, I may not follow; Don't walk behind me, I may not lead;
    Walk beside me, and just be my friend.

    Need Reviews: 1. PDF Split, PDF Merge, PDF Encrypt, PDF Decrypt and PDF Watermark

    Need Reviews: 2. Folder Locker | Lock Folder | File Locker | Locker | Encrryption | Encrypt

  4. #4
    Addicted Member
    Join Date
    Feb 2008
    Location
    XP & Vista
    Posts
    181

    Re: How To Change Desktop Background Using jpg Image

    Quote Originally Posted by abhijit View Post
    You could convert the jpg to a bmp in your code.

    vb Code:
    1. 'Code Not tested by me.
    2. If Right$(imagePath, 3) = "jpg" Or Right$(imagePath, 3) = "JPG" Or Right$(imagePath, 3) = _
    3.       "gif" Or Right$(imagePath, 3) = "GIF" Then
    4.             pic.Picture = LoadPicture(imagePath)
    5.             SavePicture pic, App.path & "\wallpaper.bmp"
    6. End If
    Works i checked myself!
    _____________________________________________
    Regrads,
    kpmsivachand

    Don't walk in front of me, I may not follow; Don't walk behind me, I may not lead;
    Walk beside me, and just be my friend.

    Need Reviews: 1. PDF Split, PDF Merge, PDF Encrypt, PDF Decrypt and PDF Watermark

    Need Reviews: 2. Folder Locker | Lock Folder | File Locker | Locker | Encrryption | Encrypt

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Nov 2009
    Location
    IRaQ / BaghDaD
    Posts
    192

    Re: How To Change Desktop Background Using jpg Image

    Thanx For Ur Help It's Worked Fine

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