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