Ejemplo n.º 1
0
void CInformErrorDialog::OnPaint()
{
	CPaintDC dc(this); // device context for painting
	
	HICON hIcon;
	CWinApp *pApp = AfxGetApp();

	ENSURE(pApp != NULL, "Could not get application object in CInformErrorDialog::OnPaint()");
	if (pApp == NULL)
		return;

	switch (m_ErrorBoxType)
	{
		case ERRORTYPE_NORMAL:
			hIcon = pApp->LoadIcon(_R(IDR_MAINFRAME));
			break;

		case ERRORTYPE_QUESTION:
// The line below is commented out (by Phil, 12/8/96) because the latest UI guidelines
// advise against using this icon.
// See "The Windows Interface Guidelines for Software Design" P.211.
//			hIcon = pApp->LoadStandardIcon(_R(IDI_QUESTION));
			hIcon = pApp->LoadStandardIcon(_R(IDI_EXCLAMATION));
			break;

		case ERRORTYPE_ERROR:
			hIcon = pApp->LoadStandardIcon(_R(IDI_EXCLAMATION));
			break;

		case ERRORTYPE_WARNING:
			hIcon = pApp->LoadStandardIcon(_R(IDI_ASTERISK));
			break;

		case ERRORTYPE_SERIOUS:
		case ERRORTYPE_ENSURE:
			hIcon = pApp->LoadStandardIcon(_R(IDI_HAND));
			break;

		default:
			ENSURE(FALSE, "Bad errortype in CInformErrorDialog::OnPaint()");
			return;
	}


	ENSURE(hIcon != NULL, "Could not load icon in CInformErrorDialog::OnPaint()");
	if (hIcon != NULL)
	{
		// Got an icon - let's draw it on the dialog.
		dc.DrawIcon(IconPos.x, IconPos.y, hIcon);
	}

	// Do not call CWnd::OnPaint() for painting messages
}
Ejemplo n.º 2
0
void CVistaTaskDialog::SetIcon(MY_TASKDIALOG_ICON tdIcon)
{
	CWinApp* pApp = AfxGetApp();
	if(pApp == NULL) { ASSERT(FALSE); return; }

	if(tdIcon == MTDI_QUESTION)
		m_hIcon = pApp->LoadStandardIcon(IDI_QUESTION);
	else { ASSERT(FALSE); } // Unknown icon ID
}
Ejemplo n.º 3
0
// @pymethod int|PyCWinApp|LoadStandardIcon|Loads an icon resource.
static PyObject *
ui_load_standard_icon(PyObject *self, PyObject *args)
{
	TCHAR *resName;
	PyObject *obName;
	// @pyparm <o PyResourceId>|resourceName||The resource name or id of the standard icon to load.
	if (!PyArg_ParseTuple(args,"O:LoadStandardIcon", &obName))
		return NULL;
	CWinApp *pApp = GetApp();
	if (!pApp) return NULL;
	if (!PyWinObject_AsResourceId(obName, &resName, FALSE))
		return NULL;
	HICON hicon = pApp->LoadStandardIcon(resName);
	PyWinObject_FreeResourceId(resName);
	if (hicon==0)
		RETURN_API_ERR("LoadStandardIcon");
	return PyWinLong_FromHANDLE(hicon);
}