wallpaper option

This is a discussion on wallpaper option within the Windows Programming forums, part of the Platform Specific Boards category; i'm trying to change the option to tile the desktop wallpaper. i'm using this code: #include <Shlobj.h> ... WALLPAPEROPT WPO; ...

  1. #1
    Unregistered
    Guest

    Angry wallpaper option

    i'm trying to change the option to tile the desktop wallpaper. i'm using this code:

    #include <Shlobj.h>
    ...
    WALLPAPEROPT WPO;
    ...
    WPO.dwStyle = WPSTYLE_TILE;
    IActiveDesktop::SetWallpaperOptions(&WPO,0);

    but i keep getting these errors:

    error C2065: 'WALLPAPEROPT' : undeclared identifier
    error C2146: syntax error : missing ';' before identifier 'WPO'
    error C2065: 'WPO' : undeclared identifier
    error C2224: left of '.dwStyle' must have struct/union type
    error C2065: 'WPSTYLE_TILE' : undeclared identifier
    error C2143: syntax error : missing ';' before ':'


    to my knowledge WALLPAPEROPT is declared in Shlobj.h. all help is appreciated.

  2. #2
    Registered User
    Join Date
    Aug 2001
    Posts
    72
    use
    #include <WININET.H>
    #include <Shlobj.h>

  3. #3
    Unregistered
    Guest
    almost worked. now i only get this error:

    error C2143: syntax error : missing ';' before ':'


    from here:

    IActiveDesktop::SetWallpaperOptions(&WPO,0);

  4. #4
    Registered User Esss's Avatar
    Join Date
    Aug 2001
    Posts
    133
    IActiveDesktop::SetWallpaperOptions(&WPO,0);
    IActiveDesktop is not a namespace, it's an interface name. Try searching MSDN for 'IActiveDesktop'.

    If you want to use this, you need to get a pointer to the shell's IActiveDesktop:

    PHP Code:
    HRESULT hr;
    IActiveDesktop *pActiveDesktop;

    //Create an instance of the Active Desktop
    hr CoCreateInstance(CLSID_ActiveDesktopNULLCLSCTX_INPROC_SERVER,
                
    IID_IActiveDesktop, (void**)&pActiveDesktop); 
    Now you can use the methods of IActiveDesktop:

    PHP Code:
    pActiveDesktop->SetWallpaperOptions(&WPO,0); 
    Be sure to release the object when you're done with it:

    PHP Code:
    pActiveDesktop->Release(); 
    You may need a later version of the Platform SDK to do this.

    I confess I would still used the registry option, particularly since the shell functions make this so easy...
    Ess
    Like a rat in a maze who says,
    "Watch me choose my own direction"
    Are you under the illusion
    The path is winding your way?
    - Rush

  5. #5
    Registered User minime6696's Avatar
    Join Date
    Aug 2001
    Posts
    267

    Post hgh

    not only that but you forgot to do the all usefull and all annoying "ZeroMemory" .

    SPH

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Unknown memory leak with linked lists...
    By RaDeuX in forum C Programming
    Replies: 6
    Last Post: 12-07-2008, 03:09 AM
  2. Replies: 3
    Last Post: 12-06-2008, 06:54 PM
  3. Memory Leak
    By jtullo in forum C Programming
    Replies: 7
    Last Post: 12-11-2006, 10:45 PM
  4. Binary Search Tree
    By penance in forum C Programming
    Replies: 4
    Last Post: 08-05-2005, 05:35 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21