Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

hi how do i use mfc or sdk to ch 1

Status
Not open for further replies.

vkarthik

Programmer
Aug 30, 2001
126
US
hi

how do i use mfc or sdk to change the wallpaper when some button is clicked. i tried IActiveDesktop, but im not able to create an object of it properly and call the methods. can anyone give the code to change the wallpaper or to instantiate iactivedesktop and call the methods? plz include the header files needed.

luv
Karthik. LOL A ship is safe in the harbour, but that's not what it is meant for!!! LOL
 

#include <windows.h>

char windir_name[] = &quot;c:\test.bmp&quot;;

SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, windir_name, SPIF_UPDATEINIFILE);
 
hi

the wallpaper changes when i call the function but the change is seen only when the screen is refreshed. how do i refresh the screen with program?

luv
Karthik.
LOL A ship is safe in the harbour, but that's not what it is meant for!!! LOL
 
I don't know what's wrong with your code. Anyway, The following code works on my machine.

#include <windows.h>

int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
::SystemParametersInfo(SPI_SETDESKWALLPAPER,
0,
(PVOID)lpCmdLine,
SPIF_UPDATEINIFILE);
return 0;
}
 
hi

thanx anyway. i've voted 4 u.

luv
karthik.
LOL A ship is safe in the harbour, but that's not what it is meant for!!! LOL
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top