Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Otros temas > Trucos
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

Los mejores trucos

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 14-10-2007
Avatar de aeff
aeff aeff is offline
Miembro
 
Registrado: oct 2006
Ubicación: Cuba, Guantánamo
Posts: 348
Poder: 18
aeff Va camino a la fama
Invento para cambiar el color-background del Desktop

Bueno, esto es realmente un invento pero simula el proceso original, je je je!!


Código Delphi [-]
...
  uses ShlObj, ActiveX, ComObj, Registry;
...

procedure SetDesktopBackground(Color: TColor);
var
  tmpFile: array[0..MAX_PATH] of Char;
  rValue, gValue, bValue, fName: string;
  Bmp: TBitmap;
  Reg: TRegistry;
  shDesk: IActiveDesktop;
  vWallPOp: TWallPaperOpt;
begin
  //
  GetEnvironmentVariable('TEMP', tmpFile, MAX_PATH);
  fName :=  string (tmpFile) + '\dbg.bmp';
  //
  rValue := IntToStr(GetRValue(Color));
  gValue := IntToStr(GetGValue(Color));
  bValue := IntToStr(GetBValue(Color));
  Bmp := TBitmap.Create;
  Bmp.Width := 1;
  Bmp.Height := 1;
  Bmp.Canvas.Pixels[0,0] := Color;
  Bmp.SaveToFile(fName);
  Bmp.Free;
  //
  Reg := TRegistry.Create;
  Reg.OpenKey('\Control Panel\Colors\', false);
  Reg.WriteString('Background',rValue + ' ' + gValue + ' ' + bValue);
  Reg.Free;
  //
  shDesk := (CreateComObject(CLSID_ActiveDesktop) as IActiveDesktop);
  shDesk.SetWallpaper(StringToOleStr(fName), 0);
  vWallPOp.dwSize := Sizeof(TWallPaperOpt);
  vWallPOp.dwStyle := WPSTYLE_TILE;
  shDesk.SetWallpaperOptions(vWallPOp, 0);
  shDesk.ApplyChanges(AD_APPLY_ALL or AD_APPLY_FORCE);
  shDesk.SetWallpaper('', 0);
  DeleteFile(fName);
  //
  FreeObjectInstance(Pointer(shDesk));
end;

un ejmplo de llamada
Código Delphi [-]
procedure TForm1.Button1Click(Sender: TObject);
begin
  SetDesktopBackground(RGB(40, 110, 112));
end;


Responder Con Cita
Respuesta


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro


La franja horaria es GMT +2. Ahora son las 22:35:12.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi