如何用delhpi程序改变win xp桌面墙纸?
aiirii快给我答复吧
thank you!

解决方案 »

  1.   

    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;
      

  2.   

    没有那么麻烦,只用一句话就可以实现了:SystemParametersInfo(SPI_SETDESKWALLPAPER,1,pointer(pchar('C:\WINDOWS\Web\Wallpaper\水帘洞.bmp')),1);缺点是必须为BMP类型的图片,如果是JPG,直接用流转一下就成Bmp了,很简单的。
      

  3.   


    ∽∝∞∽∝∞∽∝∞∽∝∞∽∝∞∽∝∞∽∝∞∽∝∞∽∝∞∽∝∞∽∝∞∽∝∞∽∝∞∽∝∞∽∝∞∽∝∞力争成为中国最大的架构师群联盟,架构师技术交流群:28995710已接近尾声,62402336正式开放!!!已经上传的顶级软件产品的架构分析,本群资料仅供研究学习,不得商用!!!
    google 、
    eBay、
    Youtube、
    淘宝等
    ......
    技术文章包括:
    《自己动手写操作系统》
    《搜索引擎-原理、技术与系统》
    《企业应用架构模式》
    ......
    重要的RUP实例
    设计模式精解
    ......
    资料陆续上传中
    ∽∝∞∽∝∞∽∝∞∽∝∞∽∝∞∽∝∞∽∝∞∽∝∞∽∝∞∽∝∞∽∝∞∽∝∞∽∝∞∽∝∞∽∝∞∽∝∞