API - animacao de janelas no win2000 |
Top Previous Next |
|
procedure AnimateSafe(const hWnd: HWND; const dwTime, dwFlags: DWord); type TAnimateWindow = function(H: THandle; B, C: DWord): Boolean; stdcall; var E : integer; AnimateWindow: TAnimateWindow; begin E := 0; try E := LoadLibrary('user32.dll'); if E > 0 then begin AnimateWindow := GetProcAddress(e, 'AnimateWindow'); if @AnimateWindow = nil then Exit else AnimateWindow(hWnd, dwTime, dwFlags); end else Exit; finally FreeLibrary(E); end; end;
procedure TForm1.FormCreate(Sender: TObject); begin AnimateSafe(Handle, 600, AW_BLEND or AW_ACTIVATE); Self.Invalidate; end; { dwFlags can be:
AW_SLIDE Uses slide animation. By default, roll animation is used. This flag is ignored when used with AW_CENTER. AW_ACTIVATE Activates the window. Do not use this value with AW_HIDE. AW_BLEND Uses a fade effect. This flag can be used only if hwnd is a top-level window. AW_HIDE Hides the window. By default, the window is shown. AW_CENTER Makes the window appear to collapse inward if AW_HIDE is used or expand outward if the AW_HIDE is not used. AW_HOR_POSITIVE Animates the window from left to right. This flag can be used with roll or slide animation. It is ignored when used with AW_CENTER or AW_BLEND. AW_HOR_NEGATIVE Animates the window from right to left. This flag can be used with roll or slide animation. It is ignored when used with AW_CENTER or AW_BLEND. AW_VER_POSITIVE Animates the window from top to bottom. This flag can be used with roll or slide animation. It is ignored when used with AW_CENTER or AW_BLEND. AW_VER_NEGATIVE Animates the window from bottom to top. This flag can be used with roll or slide animation. It is ignored when used with AW_CENTER or AW_BLEND. } |