播放GIF

ffvcff 2009-04-17 07:23:37
我想在状态中播放一个GIF格式的动画
要怎么实现啊
大家指导指导啊 谢谢ing
...全文
326 15 打赏 收藏 转发到动态 举报
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
ky310 2009-04-25
  • 打赏
  • 举报
回复
GDI+本身没直接安装,需要将某些文件copy到指定文件夹
黄志义 2009-04-18
  • 打赏
  • 举报
回复
CGI+就可以了
黄志义 2009-04-18
  • 打赏
  • 举报
回复
这个貌似gdi+有时候有这个问题 我也不知道原因 不过你可以在使用new的地方加域:: 好像可以解决
[Quote=引用 13 楼 hu_zhi_de 的回复:]


使用Image类时怎么会有很多错误:
1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusbase.h(25) : error C2059: 语法错误 : “字符串”
1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusbase.h(26) : error C2091: 函数返回函数
1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusbase.h(26) : error C2802: 静态成员“operator new”没有形参
1>c:\program files\micros…
[/Quote]
xghuzd 2009-04-18
  • 打赏
  • 举报
回复


使用Image类时怎么会有很多错误:
1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusbase.h(25) : error C2059: 语法错误 : “字符串”
1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusbase.h(26) : error C2091: 函数返回函数
1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusbase.h(26) : error C2802: 静态成员“operator new”没有形参
1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusbase.h(26) : error C2333: “Gdiplus::GdiplusBase::operator new”: 函数声明中有错误;跳过函数体
1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusbase.h(33) : error C2059: 语法错误 : “字符串”
1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusbase.h(33) : error C2090: 函数返回数组
1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusbase.h(35) : error C2059: 语法错误 : “return”
1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusbase.h(35) : error C2238: 意外的标记位于“;”之前
1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusbase.h(37) : error C2143: 语法错误 : 缺少“;”(在“}”的前面)
1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusheaders.h(23) : error C2504: “GdiplusBase”: 未定义基类
1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusheaders.h(175) : error C2504: “GdiplusBase”: 未定义基类
1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusheaders.h(245) : error C2504: “GdiplusBase”: 未定义基类
1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusheaders.h(308) : error C2504: “GdiplusBase”: 未定义基类
1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusheaders.h(373) : error C2504: “GdiplusBase”: 未定义基类
1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusheaders.h(638) : error C2504: “GdiplusBase”: 未定义基类
1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusheaders.h(706) : error C2504: “GdiplusBase”: 未定义基类
1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusimageattributes.h(39) : error C2504: “GdiplusBase”: 未定义基类
1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusmatrix.h(16) : error C2504: “GdiplusBase”: 未定义基类
1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusbrush.h(25) : error C2504: “GdiplusBase”: 未定义基类
1>c:\program files\microsoft sdks\windows\v6.0a\include\gdipluspen.h(22) : error C2504: “GdiplusBase”: 未定义基类
1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusstringformat.h(19) : error C2504: “GdiplusBase”: 未定义基类
1>c:\program files\microsoft sdks\windows\v6.0a\include\gdipluspath.h(19) : error C2504: “GdiplusBase”: 未定义基类
1>c:\program files\microsoft sdks\windows\v6.0a\include\gdipluspath.h(903) : error C2504: “GdiplusBase”: 未定义基类
1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplusgraphics.h(19) : error C2504: “GdiplusBase”: 未定义基类
1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplus.h(77) : error C2059: 语法错误 : “}”
1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplus.h(77) : error C2143: 语法错误 : 缺少“;”(在“}”的前面)
1>c:\program files\microsoft sdks\windows\v6.0a\include\gdiplus.h(77) : error C2059: 语法错误 : “}”
1>f:\设计盘\mfctest\mfctest\mfctestdlg.cpp(142) : error C2664: “LoadIconA”: 不能将参数 2 从“int”转换为“LPCSTR”
1> 从整型转换为指针类型要求 reinterpret_cast、C 样式转换或函数样式转换
xghuzd 2009-04-18
  • 打赏
  • 举报
回复
Image类。学习
DavidHsing 2009-04-18
  • 打赏
  • 举报
回复
GIF 动画的问题似乎问的人比较多啊,多数都用 CPictureEx 或 CxImage 类

我做的个小玩意儿,支持 GIF 动画,不过不是用这两个类,自己写的,核心就是起线程画每一帧:
http://blog.csdn.net/DavidHsing/archive/2009/03/24/4020197.aspx
黄志义 2009-04-18
  • 打赏
  • 举报
回复

class CGif : public Image
{
public:
virtual void AddRef(void);
virtual void Release(void);
//这里会返回下一帧和当前帧和时间间隔 用来在画的时候控制 anFramePosition表示当前要画第一帧
virtual long Draw(HDC hdc, const RECT& arcRect, unsigned int& anFramePosition);
public:
CGif(const wchar_t* filename, bool useEmbeddedColorManagement = false);
bool IsAnimatedGIF() { return m_nFrameCount > 1;}//这里判断是不是Gif
private:
void Initialize();
bool TestForAnimatedGIF();

private:
long mulRef;
bool m_bIsInitialized;
PropertyItem* m_pPropertyItem;
unsigned int m_nFrameCount;
unsigned int m_nFramePosition;
};

CGif::CGif(const wchar_t* filename, bool useEmbeddedColorManagement)
:Image(filename, useEmbeddedColorManagement)
{
mulRef = 0;

AddRef();


Initialize();

m_bIsInitialized = true;

TestForAnimatedGIF();
}

void CGif::Initialize()
{
m_nFrameCount = 0;
m_bIsInitialized = false;
m_pPropertyItem = NULL;
m_nFramePosition = 0;
}

bool CGif::TestForAnimatedGIF()
{
unsigned int count = 0;
count = GetFrameDimensionsCount();
GUID* pDimensionIDs = new GUID[count];

// Get the list of frame dimensions from the Image object.
GetFrameDimensionsList(pDimensionIDs, count);

// Get the number of frames in the first dimension.
m_nFrameCount = GetFrameCount(&pDimensionIDs[0]);

// Assume that the image has a property item of type PropertyItemEquipMake.
// Get the size of that property item.
int nSize = GetPropertyItemSize(PropertyTagFrameDelay);

// Allocate a buffer to receive the property item.
m_pPropertyItem = (PropertyItem*) malloc(nSize);

GetPropertyItem(PropertyTagFrameDelay, nSize, m_pPropertyItem);

delete [] pDimensionIDs;

return m_nFrameCount > 1;
}

void CGif::AddRef(void)
{
InterlockedIncrement(&mulRef);
}

void CGif::Release(void)
{
InterlockedDecrement(&mulRef);
if(mulRef == 0)
{
delete this;
}
}

long CGif::Draw(HDC hdc, const RECT& arcRect, unsigned int& anFramePosition)
{

GUID pageGuid = FrameDimensionTime;

if (hdc)
{
Graphics graphics(hdc);
graphics.DrawImage(this, arcRect.left, arcRect.top, arcRect.right - arcRect.left, arcRect.bottom - arcRect.top);
}

SelectActiveFrame(&pageGuid, anFramePosition++);

if (anFramePosition == m_nFrameCount)
anFramePosition = 0;

long lPause = ((long*)m_pPropertyItem->value)[anFramePosition] * 10;

return lPause;
}

[Quote=引用 9 楼 ffvcff 的回复:]
引用 8 楼 amwfnyq 的回复:

CGI+就可以了

怎样实现啊 是GDI+吗
在线等
谢谢
[/Quote]
ffvcff 2009-04-18
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 amwfnyq 的回复:]
CGI+就可以了
[/Quote]
怎样实现啊 是GDI+吗
在线等
谢谢
WaistCoat20 2009-04-17
  • 打赏
  • 举报
回复
ky310 2009-04-17
  • 打赏
  • 举报
回复
http://www.vckbase.com/code/downcode.asp?id=2074 实例源代码
ffvcff 2009-04-17
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 oyljerry 的回复:]
http://www.vchome.net/tech/graphics/graph24.htm
[/Quote]

能告诉我具体怎么做吗 我这个网页打不开
谢谢你 啊
oyljerry 2009-04-17
  • 打赏
  • 举报
回复
http://www.vchome.net/tech/graphics/graph24.htm
ffvcff 2009-04-17
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 wltg2001 的回复:]
VC6不是有现成的ACtiveX控件吗
[/Quote]
有一个animalctrl控件 只能播放avi格式的
你说的是哪个控件呢
lanneret1234 2009-04-17
  • 打赏
  • 举报
回复
http://www.vckbase.com/code/findcode.asp
wltg2001 2009-04-17
  • 打赏
  • 举报
回复
VC6不是有现成的ACtiveX控件吗

15,978

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧