首页  编辑  

Active Desktop,活动桌面

Tags: /超级猛料/OS.操作系统/桌面/   Date Created:

uses shlobj,comobj;

{ 打开/关闭活动桌面 }

function SetActiveDesktop(const b: Boolean): integer;

var

 Desktop: IActiveDesktop;

 Info: TComponentsOpt;

begin

 DeskTop := CreateComObject(CLSID_ActiveDesktop) as IActiveDesktop;

 Result := GetLastError;

 info.dwSize := sizeof(info);

 info.fActiveDesktop := b;

 info.fEnableComponents := false;

 Desktop.SetDesktopItemOptions(info, 0);

 DeskTop.ApplyChanges(AD_APPLY_ALL);

end;

uses

 ComObj, ShlObj, ActiveX;

{ 允许/关闭活动桌面 }

procedure EnableActiveDesktop(bValue: Boolean);

const

 CLSID_ActiveDesktop: TGUID = (D1: $75048700; D2: $EF1F; D3: $11D0;

   D4: ($98, $88, $00, $60, $97, $DE, $AC, $F9));

var

 MyObject: IUnknown;

 ActiveDesk: IActiveDesktop;

 twpoComponentOpt: TComponentsOpt;

begin

 MyObject := CreateComObject(CLSID_ActiveDesktop);

 ActiveDesk := MyObject as IActiveDesktop;

 with twpoComponentOpt do

 begin

   ZeroMemory(@twpoComponentOpt, SizeOf(TComponentsOpt));

   dwSize := SizeOf(twpoComponentOpt);

   fEnableComponents := bValue;

   // fActiveDesktop := True;

 end;

 ActiveDesk.SetDesktopItemOptions(twpoComponentOpt, 0);

 ActiveDesk.ApplyChanges(AD_APPLY_ALL);

end;

{ 设置活动桌面墙纸 }

function SetActiveDesktopWallpaper(FileName: string): integer;

var

 Desktop: IActiveDesktop;

 Temp: WideString;

begin

 DeskTop := CreateComObject(CLSID_ActiveDesktop) as IActiveDesktop;

 Result := GetLastError;

 Temp := FileName;

 Desktop.SetWallpaper(PWideChar(Temp), 0);

 DeskTop.ApplyChanges(AD_APPLY_ALL);

end;

{ 判断活动桌面是否存在 }

function ActiveDesktop : Boolean;

begin

 Result := FindWindowEx(FindWindowEx(FindWindowEx(

   GetDesktopWindow, 0, 'Progman', nil), 0,

   'SHELLDLL_DefView', nil), 0, 'Internet Explorer_Server',

   nil) <> 0;

end;

{ 怎样知道用户的计算机中装有活动桌面 }

olecheck(createcomobject(class_iactivedesktop))(classid具体是什么

记不清了,你再查查是什么东西,只要没有异常就是安装了活动桌面)

{ 怎样在程序中把活动桌面关闭? }

怎样在程序中把活动桌面关闭?就像在桌面上单击右键,吧"活动桌面"中的"按Web页查看"去掉.

不就是改注册表吗,这个我在行。

我在win 2000下是

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ShellState

将其中的63改为23即可。

上次有人问过如何开,这次有人问如何关,有意思。为什么不先查一查。