Window Display Effects for VO |
Users of the VO Productivity Pack 3 may have
noticed the new display effects for the VO Export Explorer splash screen -
it randomly appears to fade-in, slide or expand into view. Using the code below this feature is easy to implement in your applications as well. These display effects are based on the use of a function called AnimateWindow. This function was introduced in Windows 98 and subsequently refined in Windows 2000. I haven't yet verified what improvements may have been included in Windows ME. AnimateWindow takes three parameters:
In testing these animation types I found the following restrictions: |
METHOD Show() CLASS HelpAbout // Make the window fade into view IF SELF:Animate(1000,AW_BLEND) SELF:SetFocus() ELSE SUPER:show() ENDIF // To show window from left to right, top to bottom // SELF:Animate(500,_or(AW_HOR_POSITIVE,AW_VER_POSITIVE)) |
METHOD Close(oE) CLASS HelpAbout // Make the window fade away SELF:Animate(1000,_or(AW_HIDE,AW_BLEND)) RETURN SUPER:close(oE) |
METHOD Animate(nTime,nFlags) CLASS Window LOCAL hUser, hFunc AS PTR LOCAL hWindow AS PTR LOCAL dwTime,dwFlags AS DWORD LOCAL pVersionInfo IS _WINOSVERSIONINFO LOCAL lDone AS LOGIC // Determine Windows version pVersionInfo.dwOSVersionInfoSize := _sizeof(_WINOSVERSIONINFO) GetVersionEx(@pVersionInfo) // AW_BLEND not shown on Windows version before Win2000, // so remove it (what about ME?) IF pVersionInfo.dwMajorVersion < 5 nFlags := _And(DWORD(nFlags),_not(DWORD(AW_BLEND))) ENDIF hUser := GetModuleHandle(PSZ("USER32.DLL")) hWindow := SELF:handle() dwTime := nTime dwFlags := nFlags IF ! hUser == NULL_PTR hFunc := GetProcAddress(hUser,PSZ("AnimateWindow")) IF ! hFunc == NULL_PTR PCALL(hFunc,hWindow,dwTime,dwFlags) lDone := TRUE ELSE // method was called on an OS that does not // support AnimateWindow, e.g. Win95, WinNT4 lDone := FALSE ENDIF ENDIF RETURN lDone |
DEFINE AW_ACTIVATE := 0x00020000 DEFINE AW_BLEND := 0x00080000 DEFINE AW_CENTER := 0x00000010 DEFINE AW_HIDE := 0x00010000 DEFINE AW_HOR_NEGATIVE := 0x00000002 DEFINE AW_HOR_POSITIVE := 0x00000001 DEFINE AW_SLIDE := 0x00040000 DEFINE AW_VER_NEGATIVE := 0x00000008 DEFINE AW_VER_POSITIVE := 0x00000004 |