Ipicture 1.2 download free#
If you want not only stop the animation but to free all its resources, use CPictureEx::UnLoad() (CPictureEx::Load() calls UnLoad() automatically).īy default, the picture’s backround is filled with COLOR_3DFACE (the background color of dialog windows). You can stop the spawned thread anytime with the CPictureEx::Stop() function. If the picture is an animated GIF, the function will spawn a background thread to perform the animation, if it’s a still picture, it will be displayed right away with OleLoadPicture/IPicture. M_Picture.Load(MAKEINTRESOURCE(IDR_MYPIC),_T(“GIFTYPE”)) Īfter loading a picture, display it with CPictureEx::Draw() function. The function gets a name for the resource with a picture and a name for the type of that resource. The return value indicates the success of the loading.īOOL Load(LPCTSTR szResourceName,LPCTSTR szResourceType) The function does not free the memory, so don’t foret to GlobalFree it. This Load gets a handle to the global memory block, allocated with GlobalAlloc with GMEM_MOVEABLE flag. The function’s return type indicates the success of the loading.īOOL Load(HGLOBAL hGlobal, DWORD dwSize) This version loads a picture from the file szFileName.
BOOL IsGIF() – TRUE if the current picture is a GIF.COLORREF GetBkColor() – gets the current fill color.void SetBkColor(COLORREF) – sets the fill color for transparent areas.void UnLoad() – stops animation and releases all resources.BOOL Draw() – draws the picture or continues animation.BOOL Load(.) – loads a GIF and prepares an object for drawing.The following interface functions are available:
Of course, you can also call CPictureExWnd::Create directly – CPictureExWnd is just an ordinary window with some extra functionality in its window procedure. If (hWnd) m_wndBanner.SubclassWindow(hWnd) Īfter that, you can call CPictureExWnd::Load() and CPictureExWnd::Draw().
Ipicture 1.2 download code#
To use the ATL-version (CPictureExWnd) follow the same steps, but instead of using ClassWizard, manually add a variable of type CPictureExWnd in your class and add the following code to your WM_INITDIALOG handler function:
You can also treat CPicture as a standart CStatic, and manually create it (you’ll have to, if your host window is not a dialog) by calling CPictureEx::Create(), and then CPictureEx::Load() and CPictureEx::Draw(). in OnInitDialog (or anywhere you fancy) add these lines:.in your dialog’s header file replace the variable type from CStatic to CPictureEx (don’t forget to #include “PictureEx.h” and add PictureEx.h and PictureEx.cpp to your project).use the ClassWizard to associate a member variable (for example m_Picture) with the control added, Category – Control, Variable type – CStatic.change the ID of that control to something like IDC_MYPICTURE.add a Static text or a Picture control to your dialog (Group box will do the trick as well).Here’s how you use the MFC-version (CPictureEx): Later on, I wrote an ATL-version of the class. Note that CPictureEx can display not only GIFs (including animated GIFs) but also JPEG, BMP, WMF, ICO and CUR (that is, everything that OleLoadPicture knows of). After thoroughly reading through specifications of GIF87a and GIF89a I wrote the class that I bring to your attention.
The basic idea was to split a GIF into separate frames and display the frames with the familiar combination of OleLoadPicture and IPicture. I decided to give it a try and write my own class. Of course, I could buy a third-party library, but in that case I would pay for an extra functionality (which I didn’t actually need). Unfortunately, it had problems with displaying some of my test GIFs. Having rummaged through numerous Internet-links, I discovered that there’s only one free option available – a COM-object by George Tersaakov on CodeGuru. Static banners weren’t hard to display using the OleLoadPicture function and the IPicture interface, but dealing with animated GIFs was a whole different story. Environment: VC6 SP5, W95, W98, NT4, Win2000Ĭlass CPictureEx was written for an MFC-project, that required support for banners in JPEG and GIF formats.