Subject Re: >>Desktop Wallpaper Category AdvancedUI Posted by Weiye on 10/7/01 at 09:59 pm Rating not rated Then, try the IActiveDesktop interface functions, like SetWallpaper(...). Do a search on this board on IActiveDesktop. There are alot of similiar posts and code samples.Chen Weiye ------------------------------------------------------------------------------ When pursuing your dream, don't forget to enjoy your life... ------------------------------------------------------------------------------
systemparaminfo
不是注册表
你说的不行呀,
procedure TForm2.Button5Click(Sender: TObject);
begin
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, PChar(edit1.Text),0);
end;
edit1选择的肯定是bmp没错,但是只看到桌面刷新了一下,壁纸没变。
OpenPicDlg->FileName="";
OpenPicDlg->Execute();
name=OpenPicDlg->FileName;
if(name!=""){
TRegistry *reg=new TRegistry;
reg->RootKey=HKEY_CURRENT_USER;
if(reg->OpenKey("Control Panel\\desktop",false)==false){
MessageBox(Handle,"更改墙纸时出现错误,更改失败。","Windows进程控制",MB_ICONINFORMATION);
return;
}
reg->WriteString("Wallpaper",name);
reg->CloseKey();
delete reg;
SystemParametersInfo(SPI_SETDESKWALLPAPER,0,NULL,SPIF_UPDATEINIFILE|SPIF_SENDCHANGE);
SHChangeNotify(SHCNE_ASSOCCHANGED,SHCNF_IDLIST|SHCNF_FLUSH,NULL,NULL);
}
环境:C++Builder 5+Win2kprof
在delphi的什么单元里面?
[Error] common_san.pas(286): Undeclared identifier: 'SHChangeNotify'
[Error] common_san.pas(286): Undeclared identifier: 'SHCNE_ASSOCCHANGED'
[Error] common_san.pas(286): Undeclared identifier: 'SHCNF_IDLIST'
我想是SHChangeNotify的刷新类型不对。试试其他的系统notify手段。我这里没有死窗口现象,而且更换迅速。
Subject Re: >>Desktop Wallpaper
Category AdvancedUI
Posted by Weiye on 10/7/01 at 09:59 pm
Rating not rated
Then, try the IActiveDesktop interface functions, like SetWallpaper(...). Do a search on this board on IActiveDesktop. There are alot of similiar posts and code samples.Chen Weiye
------------------------------------------------------------------------------
When pursuing your dream, don't forget to enjoy your life...
------------------------------------------------------------------------------
应该可以的呀,我的OS是WIN2K PROFESSIONAL,不更改成功了的