Click here to Skip to main content
15,908,931 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: fading a dialogbox in Pin
vikas amin27-Dec-05 23:48
vikas amin27-Dec-05 23:48 
GeneralRe: fading a dialogbox in Pin
Owner drawn27-Dec-05 23:51
Owner drawn27-Dec-05 23:51 
GeneralRe: fading a dialogbox in Pin
_kane_28-Dec-05 0:42
_kane_28-Dec-05 0:42 
NewsRe: fading a dialogbox in Pin
_kane_28-Dec-05 1:02
_kane_28-Dec-05 1:02 
GeneralRe: fading a dialogbox in Pin
Owner drawn28-Dec-05 16:37
Owner drawn28-Dec-05 16:37 
AnswerRe: fading a dialogbox in Pin
ThatsAlok28-Dec-05 0:34
ThatsAlok28-Dec-05 0:34 
AnswerRe: fading a dialogbox in Pin
ThatsAlok28-Dec-05 0:39
ThatsAlok28-Dec-05 0:39 
AnswerRe: fading a dialogbox in Pin
BlackDice28-Dec-05 10:20
BlackDice28-Dec-05 10:20 
I use the following code in a function that allows the animations to be random. I call it in OnInitDialog() (and I think I also used it when closing the dialog).

void [ClassName]::AnimateDialog(HWND hWnd)
{
	DWORD		dwTemp2,dwTemp,dwAnimate = AW_ACTIVATE;
	int			nFirst,nSecond;
	
	//seed randomNumber Generator
	srand( (unsigned)time( NULL ) );
	nFirst = rand() % 3 + 1;
		
	switch(nFirst)
	{
	case 1:
		dwTemp = AW_SLIDE;
		break;
	case 2:
		//removed because it was AW_BLEND which doesn't seem to repaint controls correctly
	case 3:
		dwTemp = AW_CENTER;
		break;
	}
	
	dwAnimate |= dwTemp;

	//these next values will only work with AW_SLIDE
	if(nFirst == 1)
	{
		srand( (unsigned)time( NULL ) );
		nSecond = rand() % 4 + 1;
		
		switch(nSecond)
		{
			case 1:
				dwTemp2 = AW_HOR_POSITIVE ;
				break;
			case 2:
				dwTemp2 = AW_HOR_NEGATIVE;
				break;
			case 3:
				dwTemp2 = AW_VER_POSITIVE;
				break;
			default:
				dwTemp2 = AW_VER_NEGATIVE;
		}
		dwAnimate |= dwTemp2;

		srand( (unsigned)time( NULL ) );
		nSecond = rand() % 2;
		
		if(dwTemp2 == AW_VER_POSITIVE || dwTemp2 == AW_VER_NEGATIVE)
		{
			dwTemp2 = 0;
			switch(nSecond)
			{
				case 1: dwTemp2 = AW_HOR_POSITIVE; break;
				case 2: dwTemp2 = AW_HOR_NEGATIVE; break;
			}
			dwAnimate |= dwTemp2;
		}//if(dwTemp2 == AW_VER_POSITIVE || dwTemp2 == AW_VER_NEGATIVE)
		else
		{
			dwTemp2 = 0;
			switch(nSecond)
			{
				case 1: dwTemp2 = AW_VER_POSITIVE; break;
				case 2: dwTemp2 = AW_VER_NEGATIVE; break;
			}
			dwAnimate |= dwTemp2;
		}

			
			
	}//if(nFirst == 1)

	::AnimateWindow(hWnd,200,dwAnimate);
}



But as you can see, I had problems with the fade myself. However what I did for a dialog that I wanted to fade was call SetLayeredWindowAttributes() in a timer event that made the small dialog fade in and out like an Outlook mail notification.

My articles

BlackDice
QuestionSmart Device project problem Pin
LiYS27-Dec-05 20:06
LiYS27-Dec-05 20:06 
AnswerRe: Smart Device project problem Pin
Prakash Nadar27-Dec-05 21:22
Prakash Nadar27-Dec-05 21:22 
GeneralRe: Smart Device project problem Pin
LiYS27-Dec-05 22:00
LiYS27-Dec-05 22:00 
AnswerRe: Smart Device project problem Pin
Owner drawn27-Dec-05 23:02
Owner drawn27-Dec-05 23:02 
AnswerRe: Smart Device project problem Pin
sunit527-Dec-05 23:09
sunit527-Dec-05 23:09 
AnswerRe: Smart Device project problem Pin
vikas amin27-Dec-05 23:46
vikas amin27-Dec-05 23:46 
QuestionUnloading a DLL Pin
Jagadeesh VN27-Dec-05 19:53
Jagadeesh VN27-Dec-05 19:53 
AnswerRe: Unloading a DLL Pin
Prakash Nadar27-Dec-05 21:28
Prakash Nadar27-Dec-05 21:28 
QuestionReparse points Pin
kmr.girish27-Dec-05 19:47
kmr.girish27-Dec-05 19:47 
QuestionHow to include my lib file in the vc++.net 7.0 environment Pin
G Haranadh27-Dec-05 19:09
G Haranadh27-Dec-05 19:09 
AnswerRe: How to include my lib file in the vc++.net 7.0 environment Pin
Owner drawn27-Dec-05 19:13
Owner drawn27-Dec-05 19:13 
GeneralRe: How to include my lib file in the vc++.net 7.0 environment Pin
G Haranadh27-Dec-05 19:24
G Haranadh27-Dec-05 19:24 
AnswerRe: How to include my lib file in the vc++.net 7.0 environment Pin
Abhi Lahare27-Dec-05 19:18
Abhi Lahare27-Dec-05 19:18 
QuestionWhy I can't change font in CRichEditCtrl Pin
Frankdou27-Dec-05 18:40
Frankdou27-Dec-05 18:40 
AnswerRe: Why I can't change font in CRichEditCtrl Pin
Owner drawn27-Dec-05 19:11
Owner drawn27-Dec-05 19:11 
AnswerRe: Why I can't change font in CRichEditCtrl Pin
Mark F.28-Dec-05 3:37
Mark F.28-Dec-05 3:37 
GeneralRe: Why I can't change font in CRichEditCtrl Pin
Frankdou29-Dec-05 13:59
Frankdou29-Dec-05 13:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.