TCHAR szModule[MAX_PATH] = {0};
GetModuleFileName(NULL,szModule,MAX_PATH);
PathRemoveFileSpec(szModule);
PathAppend(szModule,L"success.gif");
Image img(szModule);
UINT nCount = img.GetFrameDimensionsCount();
GUID* pDimensionsIDs = (GUID*)new GUID[nCount];
img.GetFrameDimensionsList(pDimensionsIDs,nCount);
TCHAR strGUID[39]={0};
StringFromGUID2(pDimensionsIDs[0],strGUID,39);
UINT nFrameCount = img.GetFrameCount(&pDimensionsIDs[0]);
delete[] pDimensionsIDs;
int size = img.GetPropertyItemSize(PropertyTagFrameDelay);
byte* p = new byte[size];
PropertyItem* pItem = (PropertyItem*)p;
img.GetPropertyItem(PropertyTagFrameDelay,size, pItem);
int fcount = 0;
GUID guid = FrameDimensionTime;
HDC hDC = ::GetDC(pDlg->GetSafeHwnd());</span>
while(TRUE)
{
Graphics gc(hDC);
gc.DrawImage(&img,0,0,img.GetWidth(),img.GetHeight());
img.SelectActiveFrame(&guid,fcount++);
if (fcount == nFrameCount)
{
fcount = 0;
}
long pause = ((long*)pItem->value)[fcount]*10;
Sleep(pause);
}
::ReleaseDC(pDlg->GetSafeHwnd(),hDC);
GDI+播放GIF动图
最新推荐文章于 2024-06-07 22:08:12 发布