FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Temas de Hoy |
|
Herramientas | Buscar en Tema | Desplegado |
#1
|
|||
|
|||
Cambiar mi Wallpaper en RUntime
HOla!!! Necesito saber como hacer para que mi aplicacion Delphi cambie el Tapiz del Desktop por codigo y en RUntime. El ejemplo que esta en un hilo del foro no hace nada..... Trabajo sobre Win2003Server. No creo que el So sea la causa de que no funcione, pero bueno.
EN si lo que necesito es saber que hacer para que en una direccion donde esta el Jpg que quiero poner de fondo, al pasarsela a una determinada funcion(que es la que cambia el Wallpaper) ponga el JPG que esta en esa direccion de tapiz. GRACIAS!!!!! |
#2
|
||||
|
||||
Cita:
Deberás añadir al uses: ComObj y ShlObj
__________________
Germán Estévez => Web/Blog Guía de estilo, Guía alternativa Utiliza TAG's en tus mensajes. Contactar con el Clubdelphi P.D: Más tiempo dedicado a la pregunta=Mejores respuestas. |
#3
|
|||
|
|||
Cambiar el Walpaper en RunTime
ActiveDesktop.SetWallpaper('c:\winnt\Azteca.bmp', 0);
La funcion que me diste cambia mi Tapiz de maravillas!!! Siempre que se le pase como parametros una direccion propiamente dicha. Muchas gracias!!! Ahora el detalle esta en que esa direccion debe ser un PWideChar, no un string o un TCaption. Ahora necesito saber que hacer para que esta funcion soporte un String.. Probe con hacerle un casting a mi direccion string(PWideChar(Address)) pero no funciona. Me pudieran ayudar ahora con esta nueva incognita? GRACIAS |
#4
|
||||
|
||||
¿Has probado PChar(Str)?
__________________
Germán Estévez => Web/Blog Guía de estilo, Guía alternativa Utiliza TAG's en tus mensajes. Contactar con el Clubdelphi P.D: Más tiempo dedicado a la pregunta=Mejores respuestas. |
#5
|
|||
|
|||
Respondiendo a mi mismo
Hola Comunidad!!!
Despues de analizar mi problema para cambiar un desktop en RunTime programe esto: aqui les mandoe lcodigo.. espero que les sea util GRACIAS!! procedure TfrmPrincipal.CabiarWallpaper; var Tapiz, Addr: String; Cant : Integer; Num : Integer; ActiveDesktop : IActiveDesktop; Buffer : Array [0..1000]of WideChar; Direccion : PWideChar; begin Cant := ListaFicheros.Items.Count; If Aleatorio = False then begin inc(TapizActual); Try Tapiz := ListaFicheros.Items.Item[TapizActual].Caption; Addr := edtCamino.Text + '\' + Tapiz; ActiveDesktop := CreateComObject(CLSID_ActiveDesktop) as IActiveDesktop; Direccion:= StringToWideChar(Addr,Buffer,Length(Addr)+1); ActiveDesktop.SetWallpaper(Direccion,0); ActiveDesktop.ApplyChanges(AD_APPLY_ALL or AD_APPLY_FORCE); Except End; end else begin Randomize; Num := Random(Cant -1); While ((Num) > Cant) or ((Num) < 0) do begin Num := Random(Cant -1); end; Try Tapiz := ListaFicheros.Items.Item[Num].Caption; Addr := edtCamino.Text + '\' + Tapiz; ActiveDesktop := CreateComObject(CLSID_ActiveDesktop) as IActiveDesktop; Direccion:= StringToWideChar(Addr,Buffer,Length(Addr)+1); ActiveDesktop.SetWallpaper(Direccion,0); ActiveDesktop.ApplyChanges(AD_APPLY_ALL or AD_APPLY_FORCE); Except End; end; end; |
|
|
|