unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
procedure FormDestroy(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
StartButton : hWnd;
OldBitmap : THandle;
NewImage : TPicture;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
begin
NewImage := TPicture.create;
NewImage.LoadFromFile('Tech16.bmp');
StartButton := FindWindowEx(FindWindow('Shell_TrayWnd', nil),
0,
'Button',
nil);
OldBitmap := SendMessage(StartButton, BM_SetImage, 0, NewImage.Bitmap.Handle);
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
SendMessage(StartButton, BM_SetImage, 0, OldBitmap);
NewImage.Free;
end;
end.
(* ¾Æ·¡´Â ½ÃÀÛ ¸Þ´º¿¡ ±ÛÀÚ¾²±âÀε¥ Àß ¾ÈµÊ
procedure TForm1.Button1Click(Sender: TObject);
var
StartButton : hWnd;
MyRect : TRect;
MyCanvas : TCanvas;
begin
{ get the startbutton handle }
{ Obtenemos el handle al boton de Inicio}
StartButton := FindWindowEx(FindWindow(
'Shell_TrayWnd',
nil),
0,
'Button',
nil);
MyCanvas := TCanvas.Create;
try
MyCanvas.Handle := GetWindowDC(StartButton);
{ set canvas font and brush }
MyCanvas.Brush.Color := clRed;
MyCanvas.Font.Name := 'Arial';
MyCanvas.Font.Size := 10;
MyCanvas.Font.Color := clYellow;
MyCanvas.Font.Style := [fsItalic, fsBold];
{ get startbutton clientrect }
Windows.GetClientRect(StartButton,MyRect);
{ over write the startbutton }
{ Sobreescribe el boton inicio }
MyCanvas.FillRect(MyRect);
{ add your text to the startbutton }
{ A?dimos un texto al boton }
Windows.DrawText(MyCanvas.Handle,
'HOLA',
-1,
MyRect,
DT_CENTER or
DT_VCENTER or
DT_SINGLELINE);
{ give the button the appearance of a button }
{ Damos al canvas la apariencia de un boton }
DrawEdge(MyCanvas.Handle,
MyRect,
EDGE_RAISED,
BF_RECT);
finally
{ free the created DC }
{libera el DC creado}
ReleaseDC(StartButton,
MyCanvas.Handle);
{ free the temp canvas }
{Liberamoa el canvas temporal}
MyCanvas.Free;
end;
LockWindowUpdate(StartButton);
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
LockWindowUpdate(0);
end;
*) |
|