

#ifndef __mgoldfish_h__
#define __mgoldfish_h__

#pragma once


#include <atlbase.h>
#include <atlapp.h>
extern CAppModule _Module;
#include <atlwin.h>
#include <atlframe.h>
#include <atlmisc.h>
#include <atlcrack.h>

#include "resource.h"


#include <gdiplus.h>
using namespace Gdiplus;


#define TIME_ID 1


class CMGoldFishWnd : public CWindowImpl<CMGoldFishWnd, CWindow, CFrameWinTraits>
	, public CDoubleBufferImpl<CMGoldFishWnd>
{
public:
	DECLARE_WND_CLASS(_T("My Window Class"))
	//Message Crack
	BEGIN_MSG_MAP_EX(CMGoldFishWnd)
		MSG_WM_DESTROY(OnDestroy)
		MSG_WM_TIMER(OnTimer)
		MSG_WM_CREATE(OnCreate)
		MSG_WM_LBUTTONDOWN(OnLButtonDown)
		MSG_WM_MOUSEMOVE(OnMouseMove)
		MSG_WM_LBUTTONUP(OnLButtonUp)
		MSG_WM_RBUTTONDBLCLK(OnRButtonDblClk)
		MESSAGE_HANDLER(WM_SIZE, OnSize)
		END_MSG_MAP()
public:
	UINT_PTR m_nIDEvent;
	void OnDestroy();
	LRESULT OnCreate ( LPCREATESTRUCT lpcs );
	void OnTimer ( UINT_PTR uTimerID);
	LRESULT OnLButtonDown(UINT Flags, CPoint Pt);
	LRESULT OnMouseMove(UINT Flags, CPoint Pt);
	LRESULT OnLButtonUp(UINT Flags, CPoint Pt);
	LRESULT OnRButtonDblClk(UINT Flags, CPoint Pt);
	LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);


private:
	int m_BakWidth , m_BakHeight ;


	HINSTANCE hFuncInst;


	CPoint oldPoint;
	bool mouseDown;
	bool haveHandle;
	int MaxCount;
	float stepX;
	float stepY;
	int count ;
	bool speedMode;
	float left;
	float top ;

	bool toRight;
	int frameCount;
	int frame ;
	int frameWidth;
	int frameHeight;

	Image *m_pImageLeft;
	Image *m_pImageRight;

	CSize rcSize;   // the size of the rect cached from SetObjectRects
	// Device Context Attributes
	HDC m_hMemDC;
	HDC m_hWinDC;
	// Bitmap Attributes
	HBITMAP m_hBitmap;
	HBITMAP m_pOldBitmap;

	BOOL ImageFromIDResource(UINT nID, LPCTSTR sTR,Image * &pImg);

	HDC m_hdcMemory;
	void UpdateFishDisplay();
	void FixLeftTop();
	BLENDFUNCTION m_Blend;
	typedef BOOL (WINAPI *MYFUNC)(HWND,HDC,POINT*,SIZE*,HDC,POINT*,COLORREF,BLENDFUNCTION*,DWORD);          
	MYFUNC UpdateLayeredWindow;

	void CreateBitmap();
	void CleanBitmap();

	POINT ptSrc;
SIZE sizeWindow;

};







#endif//__mgoldfish_h__