Skip to content

Instantly share code, notes, and snippets.

@bstaint
Created April 3, 2017 05:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bstaint/60929a93d6cb52d0952f15ae7fd6b5d0 to your computer and use it in GitHub Desktop.
Save bstaint/60929a93d6cb52d0952f15ae7fd6b5d0 to your computer and use it in GitHub Desktop.
define CGIFANIMATE_H
#include <gdiplus.h>
#include "precompile.h"
using namespace Gdiplus;
class CGIFAnimate : public CStatic
{
public:
CGIFAnimate();
virtual ~CGIFAnimate();
virtual void PreCreate(CREATESTRUCT& cs);
virtual LRESULT OnTimer(UINT, WPARAM, LPARAM);
virtual LRESULT OnMessageReflect(UINT uMsg, WPARAM wParam, LPARAM lParam);
void Load(LPCWSTR sFileName);
void Play();
void Stop();
inline UINT getDelay()
{
assert(m_pItem);
UINT delay = ((UINT*)m_pItem[0].value)[m_CurrentFrame];
return delay != 0 ? delay * 10 : 100;
}
protected:
virtual LRESULT WndProc(UINT, WPARAM, LPARAM);
LRESULT OnDrawItem(UINT, WPARAM, LPARAM);
private:
ULONG_PTR m_gdiplusToken;
Image * m_pImage;
GUID * m_pDimensionID;
PropertyItem * m_pItem;
UINT m_CurrentFrame;
UINT m_FrameCount;
};
#endif // CGIFANIMATE_H
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment