 |
|
 |
Hi,
That is a nice class indeed.
But when I use the class in a static lib, compiled by VS2005.
It will success when I choose "Debug"
It will failed when I choose "Release"
Error 4 error LNK2001: unresolved external symbol "public: __thiscall std::exception::exception(char const * const &)" (??0exception@std@@QAE@ABQBD@Z) libcpmt.lib
Error 6 error LNK2001: unresolved external symbol "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ) libcpmt.lib
Error 8 error LNK2001: unresolved external symbol "public: virtual __thiscall std::exception::~exception(void)" (??1exception@std@@UAE@XZ) libcpmt.lib
Error 10 error LNK2001: unresolved external symbol "public: __thiscall std::exception::exception(class std::exception const &)" (??0exception@std@@QAE@ABV01@@Z) libcpmt.lib
Error 12 error LNK2001: unresolved external symbol "public: __thiscall std::exception::exception(void)" (??0exception@std@@QAE@XZ) libcpmt.lib
|
|
|
|
 |
|
 |
Hi,
I've got a dialog which has CPictureEx on it to show a GIF animation.
It works just fine when I invoke DoModal() on my dialog.
However, it doesn't animate GIF when i show my dialog with ShowWindow(SW_SHOW) .
Can it be animated with ShowWindow()?
Thanks,
Bojan
|
|
|
|
 |
|
 |
First please accept my thanks for you work
can you load more than one GIF one time?how to change the code to resolve it ?
another problem is that if i want to call Draw in a non-window enviroment ,how can I to do ?
do you have a version which the base class is CObject,in my opinion ,if the base class is CObject ,then it can be used more freely,could you please tell how to change the code?
虽非法
|
|
|
|
 |
|
 |
Hi there,
I am enjoying this class for some time now, displaying static and animated images, and recently run into the following problem:
Some of the animated GIF files, are uncorrectly displayed.
What you see in each new frame is only the "modified" part of the GIF and not the entire GIF.
It happens, as far as I know, for optimized GIFs using a single (global) palette, and not a different palette for each frame.
The GIFs are created using gdImage dll, where each new frame, uses the previous frame as reference.
did anyone encounter similaar problems displaying optimized GIFs?
TIA,
Dagan
|
|
|
|
 |
|
 |
The dialog and GIF resource in my application is embedded in a DLL, and the original ltPictureEx::Load( szResourceName, szResourceType ) couldn't locate the resource. Here is a modified version that correctly loads the resource from the DLL at runtime. (for attaching the GIF resource, I followed the instructions here : CompleteActiveX) The actual change was using AfxFindResourceHandle() instead of AfxGetResourceHandle().
BOOL ltPictureEx::Load(LPCTSTR szResourceName, LPCTSTR szResourceType)
{
ASSERT(szResourceName);
ASSERT(szResourceType);
HINSTANCE hlocation = AfxFindResourceHandle(szResourceName,szResourceType);
HRSRC hPicture = FindResource(hlocation,szResourceName,szResourceType);
HGLOBAL hResData;
if (!hPicture || !(hResData = LoadResource(hlocation,hPicture)))
{
TRACE(_T("Load (resource): Error loading resource %s\n"),szResourceName);
return FALSE;
};
DWORD dwSize = SizeofResource(hlocation,hPicture);
HGLOBAL hGlobal = GlobalAlloc(GMEM_MOVEABLE | GMEM_NODISCARD,dwSize);
if (!hGlobal)
{
TRACE(_T("Load (resource): Error allocating memory\n"));
FreeResource(hResData);
return FALSE;
};
char *pDest = reinterpret_cast<char *> (GlobalLock(hGlobal));
char *pSrc = reinterpret_cast<char *> (LockResource(hResData));
if (!pSrc || !pDest)
{
TRACE(_T("Load (resource): Error locking memory\n"));
GlobalFree(hGlobal);
FreeResource(hResData);
return FALSE;
};
CopyMemory(pDest,pSrc,dwSize);
FreeResource(hResData);
GlobalUnlock(hGlobal);
BOOL bRetValue = Load(hGlobal,dwSize);
GlobalFree(hGlobal);
return bRetValue;
}
|
|
|
|
 |
|
 |
DLL's are tricky...
Instead of using AfxFindResourceHandle use the following...
HINSTANCE GetDLLInstance ()
{
HINSTANCE hInst = GetModuleHandle("MYDLLNAME.dll");
if (hInst == NULL)
{
hInst = GetModuleHandle("MYDLLNAMEd.dll");
ASSERT(hInst != NULL);
}
return hInst;
}
Chris
|
|
|
|
 |
|
 |
That does not work for a Bimap in the resources! Do you know how to get OleLoadPicture() working for bitmap resources?
Thanks
Dave
|
|
|
|
 |
|
 |
in CEditView single document
I do like this
xxxxDoc.h
CPictureEx m_Gif;
xxxxDoc.cpp
CXXXXDoc::test()
{
m_Gif.Create("",NULL,CRect(30,30,100,100),(CEditView *)m_viewList.GetHead(),NULL);
m_Gif.ShowWindow(SW_SHOW);
if(m_Gif.Load("d:\\test.gif"))
m_Gif.Draw();
}
no error or warings
but no gif displayed.
thanks
lsmart
|
|
|
|
 |
|
 |
You said if I want to display the gif according to the size of the window, I should changle two places as following:
m_PictureSize.cx = m_pGIFLSDescriptor->m_wWidth;
m_PictureSize.cy = m_pGIFLSDescriptor->m_wHeight;
pBlockSize->cx = pImage->m_wWidth;
pBlockSize->cy = pImage->m_wHeight;
but if I do that I found that the first frame of gif is display right, but the other frames display wrong, why? And Is there any place I should change?
|
|
|
|
 |
|
|
 |
|
 |
void CPictureEx::OnPaint()
{
CPaintDC dc(this); // device context for painting
LONG nPaintWidth = m_PaintRect.right-m_PaintRect.left;
LONG nPaintHight = m_PaintRect.bottom-m_PaintRect.top;// add this line
SetWindowPos(NULL,0,0,nPaintWidth,nPaintHight,SWP_NOMOVE | SWP_NOZORDER);//add this line
if (nPaintWidth > 0)
{
LONG nPaintHeight = m_PaintRect.bottom - m_PaintRect.top;
::BitBlt(dc.m_hDC, 0, 0, nPaintWidth, nPaintHeight,
m_hMemDC, m_PaintRect.left, m_PaintRect.top, SRCCOPY);
}
else
{
::BitBlt(dc.m_hDC, 0, 0, m_PictureSize.cx, m_PictureSize.cy,
m_hMemDC, 0, 0, SRCCOPY);
}
}
|
|
|
|
 |
|
 |
void CPictureEx::OnPaint()
{
CPaintDC dc(this); // device context for painting
LONG nPaintWidth = m_PaintRect.right-m_PaintRect.left;
LONG nPaintHight = m_PaintRect.bottom-m_PaintRect.top;//
if(nPaintHight!=0&&nPaintWidth!=0)//
SetWindowPos(NULL,0,0,nPaintWidth,nPaintHight,SWP_NOMOVE | SWP_NOZORDER);//
if (nPaintWidth > 0)
{
LONG nPaintHeight = m_PaintRect.bottom - m_PaintRect.top;
::BitBlt(dc.m_hDC, 0, 0, nPaintWidth, nPaintHeight,
m_hMemDC, m_PaintRect.left, m_PaintRect.top, SRCCOPY);
}
else
{
::BitBlt(dc.m_hDC, 0, 0, m_PictureSize.cx, m_PictureSize.cy,
m_hMemDC, 0, 0, SRCCOPY);
}
}
|
|
|
|
 |
|
 |
Your example is display the gif-animation in a dialog, but I want to display it in a MFC view, and I use the following code:
m_picture.Create(NULL, SS_CENTER, rect, this, 100);
if (m_picture.Load(MAKEINTRESOURCE(IDR_GIF1),_T("GIF")))
m_picture.Draw();
but I found it didn't work, there is no gif display.why?
|
|
|
|
 |
|
 |
pPicture = new CPictureEx;
pPicture->Create(NULL, WS_CHILD|WS_VISIBLE|SS_CENTER, CRect(300,100,150,150), this);
if (pPicture->Load(picfilename))
{
pPicture->Draw();
}
|
|
|
|
 |
|
 |
If you want to have this in an CScrollView, first setscrollsizes(0,0)
and then use in onSize() ONLY SetWindowPos().
Do NOT use under any circumstances MoveWindow(),
it will create very difficult to diagnose redrawing problems.
I do not know why it is so, but this caused me to lose 1 day and a lot of neurons.
|
|
|
|
 |
|
 |
Hi great class,
In your comments you say that "If your parent window is not a dialog..." just call the CPictureExWnd::Create(). Stupid newbie question but what parameters should I pass to it?
Thanks
Chris
|
|
|
|
 |
|
|
 |
|
 |
I want to retrieve each frame from a GIF file and store them in CBitmaps. How can i do that? I`ve read your code but it`s a bit too complex for me and i heaven`t fully understood it ...Thanks in advance
|
|
|
|
 |
|
 |
Hi there!
I was tring to use this control in a "please wait" dialog. The dialog is modeless, so I can show it, do some processing and then destroy it.
The problem, is that if I use some very slow API or function call that does not processes the windows message pool, it seems to hang, even if the animation thread is running.
I don't know why, but the control never gets to be updated/painted, so the animation stops.
Do you have any suggestion on how to solve this problem?
Thanks for you time.
ALMC
|
|
|
|
 |
|
 |
I wanted to just play the .gif once, so I #if'ed out the old code and added a couple of lines to the end of ThreadAnimation(): m_nCurrFrame++; if (m_nCurrFrame == m_arrFrames.size()) #if 0 m_nCurrFrame = 0; // init the screen for the first frame, HBRUSH hBrush = CreateSolidBrush(m_clrBackground); if (hBrush) { RECT rect = {0,0,m_PictureSize.cx,m_PictureSize.cy}; FillRect(m_hMemDC,&rect,hBrush); DeleteObject(hBrush); }; // done restarting #else m_nCurrFrame--; // reset to last frame Stop(); #endif
|
|
|
|
 |
|
 |
Have tried multiple things to embed animated gif into resource - import resource, get message back: " is not a valid GIF file" and does not add. Could someone give me some additional instruction on this? Thanks
Dave Galligher
Director of Product Development
Cougar Mountain Software
davegalligher@cougarmtn.com
Voice: 208.375.4455 x180
Fax: 208.375.4460
|
|
|
|
 |
|
 |
In resource view clicked resource ,then Insert ,choose custom, you can name your resource type, then you can import the gif resources to your custom resource.
|
|
|
|
 |
|
 |
This took me a while to figure out. Whatever you name the resource "Type" in the resources, needs to be the "Type" you send in the Load() call. When adding an animated GIF as type GIF, VS doesn't let you. You can get around this by changing the file name to something else. The author of CompleteActiveX does a good job of explaining this.
|
|
|
|
 |
|
 |
I’m working in an activex control, and I want to display a gif file on its surface, so i added your class to my project and did the following.
I added a property named GIFPicture of type CString to hold the path of the gif file, and in the OnGIFPictureChange handler I added code to embed the gif file in the memory as the following(as u did in Load(CString) function):
CFile GIFPictureFile(m_cstrGIFPicture, CFile::modeRead | CFile::typeBinary);
DWORD dFileSize = GIFPictureFile.GetLength();
HGLOBAL hgGIFPicture = GlobalAlloc(GMEM_MOVEABLE | GMEM_NODISCARD, m_dwFileSize + sizeof(ULONG));
the problem occur when i want to display a GIF file with one frame, in this function:
OleLoadPicture(pStream, dFileSize, FALSE, IID_IPicture, (LPVOID *)& pPicture);
it doesn’t return a valid value, and the pPicture stay empty.
i want to ask why this happened, and how to fix it ?
Thanks for help
ken san
|
|
|
|
 |
|
 |
I was trying to use this in my WinCE
Dialog based application,
but it is giving error
not found
Can u suggest a solution.
Thanks
|
|
|
|
 |