Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
CMFCDesktopAlertWnd Class
Collapse the table of content
Expand the table of content

CMFCDesktopAlertWnd Class

The CMFCDesktopAlertWnd class implements the functionality of a modeless dialog box which appears on the screen to inform the user about an event.

class CMFCDesktopAlertWnd : public CWnd

Name

Description

CMFCDesktopAlertWnd::Create

Creates and initializes the desktop alert window.

CMFCDesktopAlertWnd::GetAnimationSpeed

Returns the animation speed.

CMFCDesktopAlertWnd::GetAnimationType

Returns the animation type.

CMFCDesktopAlertWnd::GetAutoCloseTime

Returns the auto-close time out.

CMFCDesktopAlertWnd::GetCaptionHeight

Returns the height of the caption.

CMFCDesktopAlertWnd::GetDialogSize

 

CMFCDesktopAlertWnd::GetLastPos

Returns the last valid position of the desktop alert window on the screen.

CMFCDesktopAlertWnd::GetTransparency

Returns the transparency level.

CMFCDesktopAlertWnd::HasSmallCaption

Determines whether the desktop alert window is displayed with the small caption.

CMFCDesktopAlertWnd::OnBeforeShow

 

CMFCDesktopAlertWnd::OnClickLinkButton

Called by the framework when the user clicks a link button located on the desktop alert menu.

CMFCDesktopAlertWnd::OnCommand

The framework calls this member function when the user selects an item from a menu, when a child control sends a notification message, or when an accelerator keystroke is translated. (Overrides CWnd::OnCommand.)

CMFCDesktopAlertWnd::OnDraw

 

CMFCDesktopAlertWnd::ProcessCommand

 

CMFCDesktopAlertWnd::SetAnimationSpeed

Sets the new animation speed.

CMFCDesktopAlertWnd::SetAnimationType

Sets the animation type.

CMFCDesktopAlertWnd::SetAutoCloseTime

Sets the auto-close time out.

CMFCDesktopAlertWnd::SetSmallCaption

Switches between small and normal captions.

CMFCDesktopAlertWnd::SetTransparency

Sets the transparency level.

A desktop alert window can be transparent, it can appear with animation effects, and it can disappear (after a specified delay or when the user dismisses it by clicking the close button).

A desktop alert window can also contain a default dialog that in turn contains an icon, message text (a label), and a link. Alternatively, a desktop alert window can contain a custom dialog from the application's resources.

You create a desktop alert window in two steps. First, call the constructor to construct the CMFCDesktopAlertWnd object. Second, call the CMFCDesktopAlertWnd::Create member function to create the window and attach it to the CMFCDesktopAlertWnd object.

The CMFCDesktopAlertWnd object creates a special child dialog box that fills the client area of the desktop alert window. The dialog owns all the controls that are positioned on it.

To display a custom dialog box on the popup window, follow these steps:

  1. Derive a class from CMFCDesktopAlertDialog.

  2. Create a child dialog box template in the resources.

  3. Call CMFCDesktopAlertWnd::Create using the resource ID of the dialog box template and a pointer to the runtime class information of the derived class.

  4. Program the custom dialog box to handle all notifications coming from the hosted controls, or program the hosted controls to handle these notifications directly.

Use the following functions to control the behavior of the desktop alert window:

The following example illustrates how to use various methods in the CMFCDesktopAlertWnd class to configure a CMFCDesktopAlertWnd object. The example shows how to set an animation type, set the transparency of the pop-up window, specify that the alert window displays a small caption, and set the time that elapses before the alert window automatically closes. The example also demonstrates how to create and initialize the desktop alert window. This code snippet is part of the Desktop Alert Demo sample.

	CMFCDesktopAlertWnd* pPopup = new CMFCDesktopAlertWnd;

	// int m_nAnimation
	pPopup->SetAnimationType ((CMFCPopupMenu::ANIMATION_TYPE) m_nAnimation);
	
	// int m_nAnimationSpeed
	pPopup->SetAnimationSpeed (m_nAnimationSpeed);
	
	// int m_nTransparency
	pPopup->SetTransparency ((BYTE)m_nTransparency);
	
	// BOOL	m_bSmallCaption
	pPopup->SetSmallCaption (m_bSmallCaption);

	// BOOL	m_bAutoClose, int m_nAutoCloseTime
	pPopup->SetAutoCloseTime (m_bAutoClose ? m_nAutoCloseTime * 1000 : 0);

	// int m_nPopupSource 
	if (m_nPopupSource == 0)
	{
		// int m_nVisualMngr 
		// CPoint m_ptPopup 
		// The this pointer points to a CDesktopAlertDemoDlg class which extends the CDialogEx class. 
		if (m_nVisualMngr == 5)	// MSN-style
		{
			pPopup->Create (this, IDD_DIALOG2, NULL, 
				m_ptPopup, RUNTIME_CLASS (CMSNDlg));
		}
		else
		{
			pPopup->Create (this, IDD_DIALOG1, 
				m_menuPopup.GetSubMenu (0)->GetSafeHmenu (), 
				m_ptPopup, RUNTIME_CLASS (CMyPopupDlg));
		}
	}

Header: afxDesktopAlertWnd.h

Show:
© 2015 Microsoft