I can't set the desktop wallpaper.

Alessandro Staltari 1993s008@educ.disi.unige.it
Fri Oct 23 21:27:00 GMT 1998


Hello!
 
I'm Alessandro Staltari and I have a little big 
problem with Cygnus Win32 C/C++ environment(release B19 with patched 
cygwinb19.dll).
I'm tryng to port the nice X-windows program 
xearth ( http://www.cs.colorado.edu/~tuna/xearth/index.html ) 
to windows, and I thougth to use the SystemParametersInfo function to update the 
desktop wallpaper.
The probelm is that when I try to update the 
wallpaper nothing happen to the desktop configuration, SystemParametersInfo 
returns 0 (failure) ad GetLastError returns 0 (No error). Why?
 
To test the SystemParametersInfo function I used 
the following simple program:
 
#include <windows.h>
 
int WINAPI WinMain (HINSTANCE hInstance,  
    HINSTANCE hPrevInstance,     
LPSTR   lpszCmdLine,     int     
cmdShow        ) {  if 
(SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, "c:\\screen.bmp", 
SPIF_UPDATEINIFILE))   printf("Success\n");  else 
printf("Error:%lu\n",GetLastError()); }
 
I compiled it with
gcc test.c -luser32 -lgdi32 -o 
test.exe
 
When I execute ./test.exe at the bash prompt the output 
is
 
Error:0
 
I tried to use the same SystemParametersInfo 
call in a program built with Visual C++ and it worked properly.
I also tried to use 
SystemParametersInfo to retrieve the size of the desktop not covered by the 
system tray (using the SPI_GETWORKAREA argument) and it woked with Visual C++ 
and Cygnus both.
 
I hope somebody could help me.
 
Thanks
 
Alessandro Staltari



More information about the Cygwin mailing list