CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2008
    Posts
    23

    c++ change desktop wallpaper

    right- currently I have this code:


    #include "stdafx.h"
    #include <windows.h>
    #include <stdio.h>
    #include <iostream>
    using namespace std;
    int _tmain(int argc, _TCHAR* argv[])
    {

    SystemParametersInfo( SPI_SETDESKWALLPAPER, 0, "c:/kovtunets2.jpg", SPIF_UPDATEINIFILE );
    cin.get();
    return 0;
    }




    the problem is that my wallpaper doesn't change

  2. #2
    Join Date
    Aug 2009
    Posts
    20

    Re: c++ change desktop wallpaper

    you must convert it to .bmp first and then pass bmp in SystemParametersInfo

  3. #3
    Join Date
    Jan 2008
    Posts
    23

    Re: c++ change desktop wallpaper

    yeah I tried with bmp also (converted it)

    SystemParametersInfo( SPI_SETDESKWALLPAPER, 0, "C:/kovtunets2.bmp", SPIF_UPDATEINIFILE );
    cin.get();
    return 0;


    still nothing...

  4. #4
    Join Date
    Aug 2009
    Posts
    20

    Re: c++ change desktop wallpaper

    just tested it , its not working with jpg, bmp works fine

    even your code is working correctly with bmp

  5. #5
    Join Date
    Jul 2009
    Location
    India
    Posts
    835

    Re: c++ change desktop wallpaper

    what is "C:/kovtunets2.bmp" ??

    It should be.. "C:\\kovtunets2.bmp"

  6. #6
    Join Date
    Aug 2009
    Posts
    20

    Re: c++ change desktop wallpaper

    actually both are correct

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

Featured