Originally posted by: Vinayak
Hi,
That,s really good. Thanks a lot for that. I wish more of that kind !.
Thanks once again
bye
vinayak
Reply
Originally posted by: Pete Danihel
Adding Animated Icon's are great. Try the example
ReplyOriginally posted by: Xiaojian Liu
1. Add AnimateDlgIcon.cpp and AnimateDlgIcon.h files to my project.
CAnimateDlgIcon m_animIcon;
4. Add the following code to COptionSheet::OnInitDialog()
m_animIcon.SetImageList(IDB_ANIM_IMGLIST,4,RGB(0,0,0));
5. Catch WM_DESTROY message and add the following code to
if(m_timerID != 0)KillTimer(m_timerID);
6. catch WM_TIMER handler and edit
void COptionSheet::OnTimer(UINT nIDEvent)
7. Add a member function ShowNextImage(CPropertySheet* pProsheet)
HICON hPrevIcon = (HICON) AfxGetMainWnd()->SetIcon(hIcon,FALSE);
with
HICON hPrevIcon = (HICON) pProsheet->SetIcon(hIcon,FALSE);
8. Add
to COptionSheet::OnPaint() to avoid bring up the default MFC icon.
Following the steps presented by Rajesh Parikh, I can even add
this animated icon to PropertySheet class COptionSheet, one of
the classes in my project. The steps are:
Include AnimateDlgIcon.h in the header file of COptionSheet.
2. Create a bitmap resource and put all the images (16 pixels x 16
pixels) in the desired sequence. Use IDB_ANIM_IMGLIST as the ID
of the created bitmap.
3. Add the following protected member variables to the header file
of COptionSheet:
UINT m_timerID;
m_timerID = this->SetTimer(99,500,NULL);
COptionSheet::OnDestroy():
COptionSheet::OnTimer(UINT nIDEvent) so that it looks like
{
m_animIcon.ShowNextImage(this);
CPropertySheet::OnTimer(nIDEvent);
}
to the CAnimateDlgIcon class. Copy the codes from
CAnimateDlgIcon::ShowNextImage() and replace
m_animIcon.ShowNextImage(this);
Can we add the animated icon to any Titlebar? Think about that.
Originally posted by: Frederic Pustel
BOOL CAnimateDlgIcon::ShowNextImage(CWnd * pDlg)
.
Now You must change 7 step in Usage like this :
7. Add WM_TIMER handler to your frame class and add the following code
m_animIcon.ShowNextImage(this);
To use this class with either dialog box or dialog application,
you can change the ShowNextImage function like following :
{
.
.
// send the message to frame to update icon
//HICON hPrevIcon = (HICON) AfxGetMainWnd()->SetIcon(hIcon,FALSE);
// send the message to any frame to update icon
HICON hPrevIcon = (HICON) pDlg->SetIcon(hIcon,FALSE); // NEW
// Free the previous icon resource
.
.
.
return TRUE;
}