当前位置: 首页>>代码示例>>C++>>正文


C++ CWinApp::LoadStandardIcon方法代码示例

本文整理汇总了C++中CWinApp::LoadStandardIcon方法的典型用法代码示例。如果您正苦于以下问题:C++ CWinApp::LoadStandardIcon方法的具体用法?C++ CWinApp::LoadStandardIcon怎么用?C++ CWinApp::LoadStandardIcon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CWinApp的用法示例。


在下文中一共展示了CWinApp::LoadStandardIcon方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OnPaint

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
}
开发者ID:UIKit0,项目名称:xara-xtreme,代码行数:53,代码来源:errorbox.cpp

示例2: SetIcon

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
}
开发者ID:xt9852,项目名称:KeePassXT,代码行数:9,代码来源:VistaTaskDialog.cpp

示例3: PyWinLong_FromHANDLE

// @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);
}
开发者ID:DavidGuben,项目名称:rcbplayspokemon,代码行数:19,代码来源:win32app.cpp


注:本文中的CWinApp::LoadStandardIcon方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。