在winXP中可以直接把jpeg的图像做为桌布。
不知道是转成BMP还是用了ActiveDesktop。
但其好像把JPG转为bmp因为可以在注册表中看到。
虽然我知道怎样把JPG转为BMP但我想知道XP中是否有这样一个API函数?
如果是用了activedesktop该如何调用?
或者是其他的什么方法

解决方案 »

  1.   

    under 2000,xp should be the same
    SystemParametersInfo(SPI_SETDESKWALLPAPER,0,pchar(your_filename),SPIF_UPDATEINIFILE)
      

  2.   

    回复人: RamjetZhang(我曾经不是一头猪) 这个我知道啊,但是这个只对bmp文件有作用啊。
    JPG就不行了
      

  3.   

    procedure TForm1.Button4Click(Sender: TObject);
    var
      i:Integer;
      j, dir:string;
      Reg:TRegistry;
      ADeskTop:IActiveDesktop; 
      wallpaper:PwideChar;
    begin
      dir:='C:\WINDOWS\Web\Wallpaper\';
      for i:=0 to ListBox2.Items.Count-1 do
        if ListBox2.Selected[i] then
          j:=dir + ExtractFileName(ListBox2.Items[i]);
      Reg:=TRegistry.Create;
      Reg.RootKey:=HKEY_CURRENT_USER;
      if Reg.OpenKey('Control Panel\Desktop',True) then
        Reg.WriteString('Wallpaper',j);
      ADeskTop:=CreateComObject(CLSID_ActiveDesktop) as IActiveDesktop;
      GetMem(wallpaper,128);
      ADeskTop.GetWallpaper(wallpaper,128,0);
      ADeskTop.SetWallpaper(wallpaper,0);
      ADeskTop.ApplyChanges(AD_APPLY_ALL);
      SystemParametersinfo(SPI_SETDESKWALLPAPER,0,nil,3);
      InvalidateRect(0, nil, true);
    end;
      

  4.   

    Windows的墙纸只能用微软的BMP格式,象ACDSEE这类软件都是把JPG转换成BMP然后设置的。
    你如果用ACTIVEDESKTOP,就可以用JPG文件。但是那好像需要一个HTML文件支持!
      

  5.   

    我上面的源码是可以用JPG文件的!!!
      

  6.   

    bmp & activedesk哪个更耗资源?