请问如何知道桌面发生变化,如更换了桌面图片

fei19790920 2003-01-06 02:36:45
如题
...全文
174 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
kavoe 2003-01-24
  • 打赏
  • 举报
回复

提个意见给大家参考

一般的桌面发生变化要改Win.ini和Registry,但是如果是用ACDSee改变桌面,它会用同名文件替换原来的文件,这样的话监控Win.ini和Registry就没用了,怎么办?还要监控win.ini中的桌面图片文件的改变吗?
ronaldli 2003-01-24
  • 打赏
  • 举报
回复
<<delphi 深度历险>>
哪有这东西?
yczyk 2003-01-23
  • 打赏
  • 举报
回复
这个问题挺难的,我想桌面也是快捷方式,它是一个快捷方式文件,如果我们能监控这个文件的改变也就达到了监控桌面的目的了!而要监控文件的改变就简单了,不知我的想法否合理,请大侠指教!
Wally_wu 2003-01-23
  • 打赏
  • 举报
回复
桌面发生变化一定会涉及到写Win.ini和Registry, 所以你可以检查这些内容是否已改变:
Win.ini:
[Desktop]
Wallpaper=
TileWallpaper=
WallpaperStyle=
Pattern=

Registry:
HKEY_CURRENT_USER-Control Panel-desktop:的
TileWallpaper和WallpaperStyle

fei19790920 2003-01-07
  • 打赏
  • 举报
回复
不行啊,大侠,你能不能帮我

—————————————————————————————————
中国鹰派
杀光小日本,拒绝韩日货!
fei19790920 2003-01-07
  • 打赏
  • 举报
回复
不行啊,大侠,你能不能帮我

—————————————————————————————————
中国鹰派
杀光小日本,拒绝韩日货!
Billy_Chen28 2003-01-07
  • 打赏
  • 举报
回复
或者试试监控wm_setingchange消息,先得到到桌面窗口句柄
procedure TForm1.Button1Click(Sender: TObject);
var wnd:HWND;
begin
Wnd := GetDesktopWindow;
Wnd := FindWindowEx(Wnd, 0, 'Progman', 'Program Manager');
Wnd := FindWindowEx(Wnd, 0, 'SHELLDLL_DefView', nil);
Wnd := FindWindowEx(Wnd, 0, 'SysListView32', nil);
SendMessage(Wnd, $1026, 0, $ffffffff);

......

end;

Billy_Chen28 2003-01-07
  • 打赏
  • 举报
回复
监控桌面SysListView32的WM_PAINT消息!
fei19790920 2003-01-07
  • 打赏
  • 举报
回复
上面的兄弟弄错了,我是想监控桌面,而不是设置桌面

—————————————————————————————————
中国鹰派
杀光小日本,拒绝韩日货!
hameizi 2003-01-07
  • 打赏
  • 举报
回复
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
FileCtrl, StdCtrls, Buttons, ExtCtrls,registry;

type
TForm1 = class(TForm)
Image1: TImage;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
DriveComboBox1: TDriveComboBox;
DirectoryListBox1: TDirectoryListBox;
FileListBox1: TFileListBox;
SpeedButton3: TSpeedButton;
procedure SpeedButton2Click(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.SpeedButton2Click(Sender: TObject);
begin
if filelistbox1.FileName='' then
messagedlg('请选择一个文件',mtinformation,[mbok],0)
else
image1.Picture.LoadFromFile(filelistbox1.FileName);

end;

procedure TForm1.SpeedButton1Click(Sender: TObject);
var
reg:Tregistry;
begin
if filelistbox1.FileName='' then
messagedlg('请选择一个文件',mtinformation,[mbok],0)
else
begin
reg:=tregistry.Create ;
reg.RootKey:=HKey_current_user;//设置根键名称
reg.OpenKey('control panel\desktop',false); //打开control panel\desktop 对应的主键
reg.WriteString('tilewallpaper','0');
reg.WriteString('wallpaper',filelistbox1.FileName);
systemparametersinfo(spi_setdeskwallpaper,0,nil,spif_sendchange);
reg.CloseKey;
reg.Free; //调用打开子键的参数,第二个一定为false;
end;
end;




procedure TForm1.SpeedButton3Click(Sender: TObject);
begin
close;
end;

end.
simonzone 2003-01-06
  • 打赏
  • 举报
回复
<<delphi 深度历险>>书上有你想要的东西.

5,390

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧