本文整理汇总了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
}
示例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
}
示例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);
}