C++_FLASH_

所属分类:.net编程
开发工具:Visual C++
文件大小:338KB
下载次数:53
上传日期:2008-05-23 11:02:48
上 传 者jklmn
说明:  显示多姿多彩的动画图标,正确的源码,来源于光盘资料
(Show colorful animated icon, the correct source, from the CD-ROM)

文件列表:
C++_FLASH_\ANIMATEICON.CPP (1880, 1998-11-22)
C++_FLASH_\ANIMATEICON.H (963, 1998-11-19)
C++_FLASH_\Mainfrm.cpp (3249, 1999-03-09)
C++_FLASH_\MAINFRM.H (1258, 1998-10-30)
C++_FLASH_\resource.h (641, 1998-10-30)
C++_FLASH_\StdAfx.cpp (207, 1998-10-30)
C++_FLASH_\StdAfx.h (502, 1998-10-30)
C++_FLASH_\TITLEANIM.001 (10217, 1998-11-20)
C++_FLASH_\TITLEANIM.APS (31180, 2002-01-15)
C++_FLASH_\TITLEANIM.CLW (3550, 2002-02-06)
C++_FLASH_\TITLEANIM.CPP (3726, 1998-10-30)
C++_FLASH_\TITLEANIM.DSP (4807, 1999-01-15)
C++_FLASH_\TITLEANIM.DSW (541, 1999-01-15)
C++_FLASH_\TITLEANIM.H (955, 1998-10-30)
C++_FLASH_\TITLEANIM.MAK (10217, 1998-11-20)
C++_FLASH_\TITLEANIM.MDP (42496, 1998-11-20)
C++_FLASH_\TITLEANIM.NCB (140288, 2002-02-06)
C++_FLASH_\Titleanim.opt (58880, 2002-02-06)
C++_FLASH_\TITLEANIM.PLG (2163, 2002-02-06)
C++_FLASH_\TITLEANIM.RC (11526, 1998-10-30)
C++_FLASH_\TITLEANIMDOC.CPP (1798, 1998-10-30)
C++_FLASH_\TITLEANIMDOC.H (1061, 1998-10-30)
C++_FLASH_\TITLEANIMVIEW.CPP (1983, 1998-10-30)
C++_FLASH_\TITLEANIMVIEW.H (1316, 1998-10-30)
C++_FLASH_\RES\BITMAP1.BMP (630, 1998-10-30)
C++_FLASH_\RES\TITLEANIM.ICO (1078, 1998-10-30)
C++_FLASH_\RES\TITLEANIM.RC2 (401, 1998-10-30)
C++_FLASH_\RES\TITLEANIMDOC.ICO (1078, 1998-10-30)
C++_FLASH_\RES\TOOLBAR.BMP (1078, 1998-10-30)
C++_FLASH_\RES\TOOLBAR1.BMP (822, 1998-10-30)
C++_FLASH_\Debug (0, 2008-05-23)
C++_FLASH_\RES (0, 2008-05-23)
C++_FLASH_ (0, 2008-05-23)

Animated Icon on Titlebar of a window ----------------------------------------------------------------------- This article was contributed by Rajesh Parikh. Introduction: This simple class is for people who want to make their application more attractive using icon animation in the title bar of frame window. Technique: All the consecutive images used for animation are stored in a single bitmap resource. The animation could have been achieved also by storing each image as separate icon in the resource, but that would have made managing them more difficult. Putting the images as a list of image also makes it easier to keep track of the sequence of animation. To start with the class loads the bitmap resource in a CImageList using CimageList::Create function. Then whenever ShowNextImage is called the class loads the image using CimageList::ExtractIcon and displays it in title bar by sending WM_SETICON to the frame window. Usage: 1. Add AnimateIcon.cpp and AnimateIcon.h files in your project. 2. Create a bitmap resource and put all the images (16 pixels x 16 pixels) in the desired sequence. 3. Add #include "AnimateIcon.h" at the beginning of your mainframe.h file. 4. Add the following protected members to your mainframe class CAnimateIcon m_animIcon; UINT m_timerID; 5. Add the following code in OnCreate member of your frame class m_animIcon.SetImageList(IDB_ANIM_IMGLIST,4,RGB(0,0,0)); m_timerID = this->SetTimer(99,500,NULL); SetImageList takes 3 parameters pass ID of your bitmap resource created in step 2 as first parameter. The second parameter is the no of (16x16) images in your bitmap, which is 4 in our case. The last parameter is the RGB value of color you want to make transparent. Second line of code sets a new timer. Here I have made it to fire every 500 ms. you can change it to suit your animation speed. 6. Create a OnDestroy()handler for your main frame class and add the following code. This is very important because if you do not kill the timer created you will lose system resources. CFrameWnd::OnDestroy(); if(m_timerID != 0) KillTimer(m_timerID); 7. Add WM_TIMERhandler to your frame class and add the following code m_animIcon.ShowNextImage(); Compile and run the code. Now you should be able to see your window icon being animated. Note that just adding the above code also would bring up default MFC icon for a moment. If you want to avoid this change the IDR_MAINFRAME icon in the resource. Note: The sample project is built using Visual C++ 4.1, and has been tested on Visual C++ versions 4.1 and 6.0. If you directly try to run the .exe in the sample project it may ask for VC 4.1 runtime DLLs. Download demo project - 46 KB Download source - 2 KB Date Posted: October 30, 19***

近期下载者

相关文件


收藏者