I
import
Unregistered / Unconfirmed
GUEST, unregistred user!
以下代码在 Win2000中可以实现。 const
WS_EX_LAYERED = $00080000;
var
DC: HDC;
FStyle: Longint;
FCanvas: TCanvas;
bmpScreen : TBitamp;
begin
FStyle := GetWindowLong(FFadeWin.Handle, GWL_EXSTYLE);
FStyle := FStyle or WS_EX_LAYERED;
SetWindowLong(FFadeWin.Handle, GWL_EXSTYLE, FStyle);
Sleep(50);
bmpScreen := TBitamp.Create;
bmpScreen.Width := FFadeWin.Width;
bmpScreen.Height := FFadeWin.Height;
bmpScreen.Canvas.Lock;
DC := GetDC(0);
with bmpScreen do
Bitblt(Canvas.Handle, 0, 0,
FFadeWin.Width, FFadeWin.Height,
DC, FFadeWin.Left, FFadeWin.Top, SRCCOPY);
ReleaseDC(0, DC);
bmpScreen.Canvas.UnLock;
FStyle := GetWindowLong(FFadeWin.Handle, GWL_EXSTYLE);
FStyle := FStyle and (not WS_EX_LAYERED);
SetWindowLong(FFadeWin.Handle, GWL_EXSTYLE, FStyle);
end;
WS_EX_LAYERED = $00080000;
var
DC: HDC;
FStyle: Longint;
FCanvas: TCanvas;
bmpScreen : TBitamp;
begin
FStyle := GetWindowLong(FFadeWin.Handle, GWL_EXSTYLE);
FStyle := FStyle or WS_EX_LAYERED;
SetWindowLong(FFadeWin.Handle, GWL_EXSTYLE, FStyle);
Sleep(50);
bmpScreen := TBitamp.Create;
bmpScreen.Width := FFadeWin.Width;
bmpScreen.Height := FFadeWin.Height;
bmpScreen.Canvas.Lock;
DC := GetDC(0);
with bmpScreen do
Bitblt(Canvas.Handle, 0, 0,
FFadeWin.Width, FFadeWin.Height,
DC, FFadeWin.Left, FFadeWin.Top, SRCCOPY);
ReleaseDC(0, DC);
bmpScreen.Canvas.UnLock;
FStyle := GetWindowLong(FFadeWin.Handle, GWL_EXSTYLE);
FStyle := FStyle and (not WS_EX_LAYERED);
SetWindowLong(FFadeWin.Handle, GWL_EXSTYLE, FStyle);
end;