LAnimationWindow::IsValidAnimation

#include "ltwrappr.h"

L_BOOL LAnimationWindow::IsValidAnimation() const

Determines whether the LAnimationWindow object is valid.

Returns

TRUE

The LAnimationWindow object is valid.

FALSE

The LAnimationWindow object is not valid.

Comments

Before you can use any of the animation playback functions, a valid LBitmapList object must be associated with the class object. Until you have associated a bitmap list with the LAnimationWindow object, the object is considered invalid.

You can associate a bitmap list with the LAnimationWindow object using the constructor(LAnimationWindow::LAnimationWindow), LAnimationWindow::SetBitmapList, or LAnimationWindow::Load.

Note: This function also determines whether the current file is an animated GIF file. If the file contains more than one page, the function will return TRUE.

Required DLLs and Libraries

LTDIS
LTDLG
LTEFX
LTFIL
LTIMG
LTSCR
LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

Platforms

Win32, x64.

See Also

Functions:

Class Members

Example

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName
L_INT LAnimationWindow_IsValidAnimationExample(HWND hWndParent)
{
   L_INT nRet;
   LBase::LoadLibraries(LT_ALL_LEADLIB);
   //make sure all libraries are loaded
   LBitmap Bitmap;
   LBitmapList MyBitmapList;
   LAnimationWindow MyAnimation;
   L_TCHAR  * pszFiles[] = {MAKE_IMAGE_PATH(TEXT("image1.cmp")),
                            MAKE_IMAGE_PATH(TEXT("image2.cmp")),
                            MAKE_IMAGE_PATH(TEXT("ImageProcessingDemo\\Image3.cmp"))};
   MyBitmapList.Create();
   for (int i = 0 ; i<3; i++)
   {
      nRet = Bitmap.Load(pszFiles[i]);
      if (nRet !=SUCCESS)
      {
         MessageBox(hWndParent, TEXT("Failed to load file"),TEXT("Error!"),MB_OK | MB_ICONSTOP);
         return nRet;
      }
      nRet = MyBitmapList.InsertItem(&Bitmap);
      if(nRet != SUCCESS)
         return nRet;
   }
   MyAnimation.SetBitmapList(&MyBitmapList);
  
   if (MyAnimation.IsValidAnimation())
   {
      MyAnimation.CreateWnd(hWndParent,0, WS_VISIBLE|WS_CHILD|WS_BORDER,0,0,800,600);
      MyAnimation.SetDelay(1000);
      MyAnimation.SetBackgroundColor(RGB(255,255,255));
      
      nRet = MyAnimation.PlayAnimation();
      if(nRet != SUCCESS)
         return nRet;
      while (MyAnimation.IsPlaying())
      {
         if (MyAnimation.DoEvents())
            break; 
 
      }
      MessageBox(hWndParent, TEXT("Press Ok to terminate"),TEXT("Error!"),MB_OK | MB_ICONSTOP);
   }
   return SUCCESS;
}