07-07-2009 03:26 AM
I am using LabWindows CVI 8.0.1 with an application that uses the following line:
SetWallpaper (0, ".\\CompanyImage.bmp");
where "CompanyImage.Bmp" is locate to the executable. This line works in that it sets the Windows XP SP2 wallpaper to the CompanyImage.bmp, but after rebooting the PC and logging back into the account the wallpaper is gone (until I run the application again).
Is the SetWallpaper function call not designed to apply the wallpaper setting permanently?
Solved! Go to Solution.
07-08-2009 04:54 AM
Hi Christopher,
Thank you for contacting National Instruments. I am currently looking at this issue for you, but I do have a couple of requests:
1. Could you possibly attach your project to this Forum post? That will give us a clear picture of what your application is doing.
2.What are the Windows group policies for this machine? Is the user an Administrator or a standard User? Are there any settings that are applied during startup?
I shall find out if the SetWallpaper function sets the wallpaper permanently.
Many thanks,
07-08-2009 05:10 AM
I cannot attach the code as it is company sensitive. However it consists of Main function that does the following:
if (InitCVIRTE (0, argv, 0) == 0)
return -1; /* out of memory */
Calls LoadPanel for two panels in the UIR.
SetWallpaper (0, ".\\CompanyImage.bmp");
Does other stuff (setting up the panels, displaying them etc).
The PC is a Standard Windows XP install. There are five users. Two have administrator rights the others are limited accounts. The problem is observed on the Administrator account.
It is not really an issue on the limited accounts as the software is in the StartUp Menu group (i.e. runs as soon as the user logs in). The program goes full screen and disables the Task Bar so they cannot get at the Desktop anyway. When they quit the program it logs them out.
When the software is run on the Administrator account or the other account with admin rights, my software is not started automatically. If I do run it and kill it in the Task Manager then the wallpaper is set to "CompanyImage.bmp". If I then log out and then log in again the wallpaper has been disappeared.
07-09-2009 07:41 AM
Further investigation showed that the registry key was been set and that the "CompanyImage" bmp was selected in the Desktop Tab of Display Properties. However it seems that it does not support relative directory locations, as the registry entry was as follows:
HKEY_CURRENT_USER\Control Panel\Desktop\Wallpaper = ".\CompanyImage.bmp"
I added a call to GetDir and passed the full path to the SetWallpaper function and it worked on the target PC. It should be noted though that this function seems to not set the wallpaper at all if Active Desktop is running and it is locked.
However problem solved....
07-10-2009 03:26 AM
Hi Christopher,
I think the inability to set the background when active desktop is set is something that Microsoft have set as part of their OS. I found an article which seems to mention this.
I am glad you managed to solve your issue.
Many thanks,