The SetLayeredWindowAttributes API must be supported on systems below Windows 2000. The principle is to find the window handle first and then set the window properties.
PRogram opacity;
{$APPTYPE CONSOLE}
uses
SysUtils,
Windows;
var
handle,AStyle:integer;
Begin
try
if ParamCount<2 then
Begin
Writeln('parameter must');
exit;
end;
handle:=findwindow(nil,pchar(ParamStr(1)));// Currently, it is the Text for looking for windows, or it can be looking for ClassName
AStyle := GetWindowLong(Handle, GWL_EXSTYLE);
SetWindowLong(Handle, GWL_EXSTYLE, AStyle or WS_EX_LAYERED);
if SetLayeredWindowAttributes(Handle, 0, strtoint(ParamStr(2)),LWA_ALPHA) then
Writeln(ParamStr(1)+' update succeeded to '+ParamStr(2))
else
Writeln('Opacity update failed');
except
Writeln('parameter error');
end;
end.
http://blog.csdn.net/redbirdli/archive/2007/02/15/1510602.aspx