
| BOOL SystemParametersInfo( UINT uiAction, // system parameter to query or set UINT uiParam, // depends on action to be taken PVOID pvParam, // depends on action to be taken UINT fWinIni // user profile update flag ); |
| 键名 | 含义 |
| WallPaper | 桌布的文件名,但只限于BMP格式的位图 |
| WallPaperStyle | 设置桌布样式 若为0,桌布将以原始尺寸显示在桌面中央 若为1,桌布将填满桌面 若为2,将桌布放大的画面大小,图像有可能失真 |
| WallPaperOriginX | 如果WallPaperStyle为0,则这表示图像左上角X轴坐标 |
| WallPaperOriginY | 如果WallPaperStyle为0,则这表示图像左上角Y轴坐标 |
| #include <ReGIStry.hpp> //先在注册表里添好桌布样式,在设置桌布 TRegistry *Registry = new TRegistry; try { Registry->OpenKey(“\\Control Panel\\Desktop”,false); Registry->WriteString("TileWallpaper","0"); //设置桌布样式 Registry->WriteString("WallpaperStyle",wallStyle); } __finally { delete Registry; } } //设置桌布 SystemParametersInfo(SPI_SETDESKWALLPAPER, 0,FileName.c_str(),SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE); |
| void __fastcall TForm1::Timer1Timer(TObject *Sender) { if (ListBox1->Items->Count<=0) { return ; } if (index>=ListBox1->Items->Count) { index=0; } //如果是JPG格式就将其转换为BMP格式,将其存到临时文件夹中 if(UpperCase(ListBox1->Items->Strings[index]).Pos(".JPG")|| UpperCase(ListBox1->Items->Strings[index]).Pos(".JPEG")) { AnsiString fileName=ExtractFileName(ListBox1->Items->Strings[index]); int len=fileName.LastDelimiter("."); fileName=fileName.SubString(0,len-1)+".bmp"; unsigned int *size=new unsigned int(256); char * buffer=new char[256]; GetTempPath(*size,buffer); fileName=AnsiString(buffer)+fileName; JPEGToBMP(ListBox1->Items->Strings[index],fileName); //设置桌布 SystemParametersInfo(SPI_SETDESKWALLPAPER,0,ListBox1->Items->Strings[index].c_str(), SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE); } else { //设置桌布 SystemParametersInfo(SPI_SETDESKWALLPAPER,0,ListBox1->Items->Strings[index].c_str(), SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE); } //重建系统缓存 RebuildIconCache(); index++; } |
英特尔 酷睿(TM)2双核,送指纹识别器一个,再赠两份好礼,请电800-858-2418