Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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