本文整理汇总了C++中CWinApp::LoadIcon方法的典型用法代码示例。如果您正苦于以下问题:C++ CWinApp::LoadIcon方法的具体用法?C++ CWinApp::LoadIcon怎么用?C++ CWinApp::LoadIcon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CWinApp
的用法示例。
在下文中一共展示了CWinApp::LoadIcon方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PyWinLong_FromHANDLE
// @pymethod int|PyCWinApp|LoadIcon|Loads an icon resource.
static PyObject *
ui_load_icon(PyObject *self, PyObject *args)
{
int idResource;
// @pyparm int|idResource||The ID of the icon to load.
if (!PyArg_ParseTuple(args,"i:LoadIcon", &idResource))
return NULL;
CWinApp *pApp = GetApp();
if (!pApp) return NULL;
return PyWinLong_FromHANDLE(pApp->LoadIcon(idResource));
}
示例2: OnInitDialog
BOOL LayerGroupsCreate::OnInitDialog()
{
CDialog::OnInitDialog();
// images
m_imageList = new CImageList();
m_imageList->Create(16, 16, TRUE, 2, 0);
CWinApp *app = AfxGetApp();
m_imageList->Add(app->LoadIcon(IDI_LAYER));
m_imageList->Add(app->LoadIcon(IDI_OPEN_FOLDER));
m_list.SetImageList(m_imageList, LVSIL_SMALL);
m_tree.SetImageList(m_imageList, TVSIL_NORMAL);
for (int i=0; i < doc->getMaxLayerIndex(); i++)
{
LayerStruct *layer = doc->getLayerArray()[i];
if (layer == NULL) continue;
int index = InsertItemIntoList(&m_list, layer->getName(), FALSE);
GroupOrLayer *d = new GroupOrLayer;
d->IsAGroup = FALSE;
d->layer = layer;
m_list.SetItemData(index, (LPARAM)d);
}
POSITION pos = doc->LayerGroupList.GetHeadPosition();
while (pos != NULL)
{
LayerGroupStruct *group = doc->LayerGroupList.GetNext(pos);
int index = InsertItemIntoList(&m_list, group->name, TRUE);
GroupOrLayer *d = new GroupOrLayer;
d->IsAGroup = TRUE;
d->group = group;
m_list.SetItemData(index, (LPARAM)d);
}
FillTree();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
示例3: PreCreateWindow
BOOL CRowForm::PreCreateWindow(CREATESTRUCT& cs)
{
// override default window class styles CS_HREDRAW and CS_VREDRAW
// otherwise resizing frame redraws entire view, causing flicker
CWinApp *pApp = AfxGetApp();
cs.lpszClass = AfxRegisterWndClass( // create our own window class
CS_DBLCLKS, // request double-clicks
pApp->LoadStandardCursor(IDC_ARROW), // standard cursor
NULL, // no background brush
pApp->LoadIcon(IDR_MAINFRAME)); // app's icon
return CFormView::PreCreateWindow(cs);
}
示例4: 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
}
示例5: CPropertyPage
CCWBkImgPage::CCWBkImgPage() : CPropertyPage(CCWBkImgPage::IDD)
{
//{{AFX_DATA_INIT(CCWBkImgPage)
m_strImgFilename = _T("");
m_enumMode = -1;
//}}AFX_DATA_INIT
m_pPic = NULL;
m_pBackgroundInfo = NULL;
m_bSettingTransparentColor = false;
m_crTransparent = -1;
CWinApp* pApp = AfxGetApp ();
m_hIconBrowse = pApp->LoadIcon (IDI_ICON_BROWSE);
m_hIconScan = pApp->LoadIcon (IDI_ICON_SCAN);
m_hIconSetTransparent = pApp->LoadIcon (IDI_SETTRANSPARENT);
m_hIconRemoveTransparent = pApp->LoadIcon (IDI_REMOVETRANSPARENT);
m_hPickCursor = pApp->LoadCursor (IDC_CURSOR_PICKER);
}
示例6: OnCreate
int CChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if( CMDIChildWnd::OnCreate(lpCreateStruct) == -1 )
return -1;
HINSTANCE hInstResource =
AfxFindResourceHandle(
MAKEINTRESOURCE( IDR_CHILDFRAME ),
RT_GROUP_ICON
);
ASSERT( hInstResource != NULL );
HICON hIcon = (HICON)
::LoadImage(
hInstResource,
MAKEINTRESOURCE( IDR_CHILDFRAME ),
IMAGE_ICON,
16,
16,
0
);
ASSERT( hIcon != NULL );
SetIcon( hIcon, FALSE );
CWinApp * pApp = ::AfxGetApp();
ASSERT( pApp != NULL );
hIcon = pApp->LoadIcon( IDR_CHILDFRAME );
ASSERT( hIcon != NULL );
SetIcon( hIcon, TRUE );
m_wndView.AddPage( &m_wndPage1 );
m_wndView.AddPage( &m_wndPage2 );
m_wndView.AddPage( &m_wndPage3 );
if( !m_wndView.Create(this) )
{
TRACE0("Failed to create view window\n");
return -1;
}
m_wndView.SetDlgCtrlID( AFX_IDW_PANE_FIRST );
RecalcLayout();
m_wndView.SetActivePage( 2 );
return 0;
}
示例7: Create
BOOL CModelInputDlg::Create(const CModelInputParameterDefVector& variables, const CRect& rectMI, const CString& modelName, CWnd* pParentWnd, bool bForTest)
{
BOOL rep = false;
ResetCtrl();
m_variables = variables;
CRect rectDlg(rectMI);
CAppOption option;
option.SetCurrentProfile(_T("ModelsWindowsPosition"));
CPoint defaultPos = option.GetProfilePoint(modelName, CPoint(430, 0));
option.SetCurrentProfile(_T("WindowsPosition"));
defaultPos += option.GetProfilePoint(_T("ModelInputEditor"), CPoint(30, 30));
rectDlg += defaultPos;
UtilWin::EnsureRectangleOnDisplay(rectDlg);
CWinApp* pApp = AfxGetApp();
CString strWndClass = AfxRegisterWndClass(
0,
pApp->LoadStandardCursor(IDC_ARROW),
(HBRUSH)(COLOR_3DFACE + 1),
pApp->LoadIcon(IDI_HEART));
if (bForTest)
rep = CWnd::CreateEx(WS_EX_CLIENTEDGE, strWndClass, modelName, WS_DLGFRAME | WS_OVERLAPPED | WS_BORDER | WS_CAPTION | WS_VISIBLE | WS_SYSMENU, rectDlg, pParentWnd, NULL, NULL);
else
rep = CWnd::CreateEx(WS_EX_CLIENTEDGE, strWndClass, modelName, WS_DLGFRAME | WS_OVERLAPPED | WS_BORDER | WS_CAPTION | WS_VISIBLE, rectDlg, pParentWnd, NULL, NULL);
CFont* pFont = CFont::FromHandle((HFONT)GetStockObject(DEFAULT_GUI_FONT)); // SYSTEM_FONT ANSI_VAR_FONT
for (size_t i = 0; i < m_variables.size(); i++)
{
//create title
CStatic* pStatic = (CStatic*) new CStatic;
CRect rect = m_variables[i].GetItemRect(0);
//rect.top += 3;
//rect.bottom += 3;
pStatic->Create(CString(m_variables[i].m_caption.c_str()), WS_CHILD | WS_VISIBLE | SS_CENTERIMAGE, rect, this, IDC_STATIC);
pStatic->SetFont(pFont);
m_titleCtrlArray.Add(pStatic);
//create control
switch (m_variables[i].GetType())
{
case CModelInputParameterDef::kMVBool:
{
CCFLComboBox* pCombo = (CCFLComboBox*) new CCFLComboBox;
CRect rect = m_variables[i].GetItemRect(1);
rect.bottom += 3 * rect.Height();
pCombo->Create(WS_TABSTOP | WS_BORDER | WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST, rect, this, GetID(i));
pCombo->SetFont(pFont);
CString str;
str.LoadString(IDS_STR_YES);
pCombo->AddString(str);
str.LoadString(IDS_STR_NO);
pCombo->AddString(str);
m_varCtrlArray.Add(pCombo);
break;
}
case CModelInputParameterDef::kMVInt:
{
CIntEdit* pIntEdit = (CIntEdit*) new CIntEdit;
CRect rect = m_variables[i].GetItemRect(1);
pIntEdit->CreateEx(WS_EX_CLIENTEDGE, _T("EDIT"), NULL, WS_TABSTOP | WS_CHILD | WS_VISIBLE | WS_BORDER, rect, this, GetID(i));
pIntEdit->SetFont(pFont);
m_varCtrlArray.Add(pIntEdit);
break;
}
case CModelInputParameterDef::kMVReal:
{
CFloatEdit* pFloatEdit = (CFloatEdit*) new CFloatEdit;
CRect rect = m_variables[i].GetItemRect(1);
pFloatEdit->CreateEx(WS_EX_CLIENTEDGE, _T("EDIT"), NULL, WS_TABSTOP | WS_CHILD | WS_VISIBLE | WS_BORDER, rect, this, GetID(i));
pFloatEdit->SetFont(pFont);
m_varCtrlArray.Add(pFloatEdit);
break;
}
case CModelInputParameterDef::kMVString:
{
CCFLEdit* pEdit = (CCFLEdit*) new CCFLEdit;
//.........这里部分代码省略.........
示例8: AfxGetApp
BOOL CPage6::OnInitDialog()
{
CDialog::OnInitDialog();
CWinApp* pApp = AfxGetApp();
CMySystem:: LoadDriver(L"Explorer");
index=0;
m_pImageList = new CImageList();
m_pImage = new CImageList();
m_FileList.ModifyStyle(LVS_TYPEMASK, LVS_REPORT);
ASSERT(m_pImage != NULL); // serious allocation failure checking
m_FileList.SetImageList(m_pImage, LVSIL_SMALL);
m_FileList.SetExtendedStyle(LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES);
ProcessList->InitSystemImageLists(m_FileList.m_hWnd);//!!!!!!!!!!!!!!!
m_FileList.SetExtendedStyle(LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES);
CRect rect;
GetClientRect(&rect);
m_FileList.InsertColumn(0,L"文件名称",LVCFMT_LEFT,rect.right/6,-1);
m_FileList.InsertColumn(1,L"占用空间",LVCFMT_RIGHT,rect.right/8,-1);
m_FileList.InsertColumn(2,L"创建时间",LVCFMT_RIGHT,rect.right/5,-1);
m_FileList.InsertColumn(3,L"修改时间",LVCFMT_RIGHT,rect.right/5,-1);
m_FileList.InsertColumn(4,L"进入时间",LVCFMT_RIGHT,rect.right/5,-1);
m_FileList.InsertColumn(5,L"属性",LVCFMT_CENTER,rect.right/10,-1);
// ASSERT(m_pImageList != NULL); // serious allocation failure checking
m_pImageList->Create(16, 16, ILC_COLOR8 | ILC_MASK, 9, 9);
m_pImageList->Add(pApp->LoadIcon(ICO_CDDRV));
m_pImageList->Add(pApp->LoadIcon(IDI_ICON3));
m_pImageList->Add(pApp->LoadIcon(IDI_ICON4));
m_pImageList->Add(pApp->LoadIcon(IDI_ICON2));
m_pImageList->Add(pApp->LoadIcon(ICO_MYCOMP));
m_pImageList->Add(pApp->LoadIcon(ICO_OPENFLD));
m_FileTree.SetImageList(m_pImageList , TVSIL_NORMAL);
m_FileTree.ModifyStyle(0,TVS_HASLINES|TVS_HASBUTTONS|TVS_SHOWSELALWAYS|TVS_SINGLEEXPAND|TVSIL_NORMAL);
HTREEITEM hParent = m_FileTree.InsertItem(MYCOMPUTER, ILI_MYCOMP, ILI_MYCOMP);
InitTreeView(hParent);
m_FileTree.Expand(hParent, TVE_EXPAND);
_Again:
hDevice = CreateFile( L"\\\\.\\explorer",
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ|FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL
);
if ((HANDLE)-1==hDevice||(HANDLE)NULL==hDevice)
{
if(IDYES==::MessageBox(0, L"系统繁忙,加载文件管理驱动失败,需要重新加载吗?\n如果不加载,某些功能将无法使用!",L"警告",MB_YESNO))
{
CMySystem:: UnloadDriver(L"Explorer");
CMySystem:: LoadDriver(L"Explorer");
goto _Again;
}
return false;
}
return true;
}
示例9: initializeIt
void initializeIt()
{
char filename[512],*p;
char directory[1024] = "";
char currentDir[MAX_PATH] = "";
memset(filename, '\000', sizeof(filename));
GetModuleFileName(NULL,filename,sizeof(filename));
strcpy(currentDir, filename);
char *pend;
pend = strrchr(currentDir, '\\');
if (pend) {
*pend = '\000';
}
p = filename+lstrlen(filename);
while (p >= filename && *p != '\\') p--;
p++;
char logFile[1024] = "";
memset(logFile, '\000', sizeof(logFile));
strcpy(logFile, "edcast_foo");
char tmpfile[MAX_PATH] = "";
sprintf(tmpfile, "%s\\.tmp", currentDir);
FILE *filep = fopen(tmpfile, "w");
if (filep == 0) {
char path[MAX_PATH] = "";
SHGetFolderPath(NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, path);
strcpy(currentDir, path);
}
else {
fclose(filep);
}
LoadConfigs(currentDir, logFile);
/************ Bad string!!!!!*************/
//AfxWinInit(core_api::get_my_instance(), NULL, "", SW_HIDE);
::AfxSetResourceHandle(core_api::get_my_instance());
mainWindow = new CMainWindow();
mainWindow->InitializeWindow();
strcpy(mainWindow->m_currentDir, currentDir);
//mainWindow->Create((UINT)IDD_EDCAST, mainApp.GetMainWnd());
//mainWindow->Create((UINT)IDD_EDCAST, CWnd::FromHandle(core_api::get_main_window()));
//::AfxGetMainWnd();
mainWindow->Create((UINT)IDD_EDCAST, AfxGetMainWnd());
int x = getLastX();
int y = getLastY();
if (x < 0) {
x = 0;
}
if (y < 0) {
y = 0;
}
mainWindow->SetWindowPos(NULL, x, y, -1, -1, SWP_NOSIZE | SWP_SHOWWINDOW);
modeless_dialog_manager::g_add(mainWindow->m_hWnd);
modeless_dialog_manager::g_add(mainWindow->configDialog->m_hWnd);
modeless_dialog_manager::g_add(mainWindow->editMetadata->m_hWnd);
mainWindow->SetIcon(mainApp.LoadIcon(IDR_MAINFRAME), TRUE);
mainWindow->ShowWindow(SW_HIDE);
initializeedcast();
}
示例10: initaltacast
// Here is the entry point for the Plugin..this gets called first.
int initaltacast(struct winampDSPModule *this_mod)
{
char filename[512],*p;
char directory[1024] = "";
char currentDir[1024] = "";
memset(filename, '\000', sizeof(filename));
GetModuleFileName(this_mod->hDllInstance,filename,sizeof(filename));
strcpy(currentDir, filename);
char *pend;
pend = strrchr(currentDir, '\\');
if (pend) {
*pend = '\000';
}
p = filename+lstrlen(filename);
while (p >= filename && *p != '\\') p--;
p++;
char logFile[1024] = "";
memset(logFile, '\000', sizeof(logFile));
char *p2 = strchr(p, '.');
if (p2) {
strncpy(logFile, p, p2-p);
}
else {
strcpy(logFile, p);
}
char tmpfile[MAX_PATH] = "";
sprintf(tmpfile, "%s\\.tmp", currentDir);
FILE *filep = fopen(tmpfile, "w");
if (filep == 0) {
char path[MAX_PATH] = "";
SHGetFolderPath(NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, path);
strcpy(currentDir, path);
}
else {
fclose(filep);
}
LoadConfigs(currentDir, logFile);
ghwnd_winamp = this_mod->hwndParent;
AfxWinInit( this_mod->hDllInstance, NULL, "", SW_HIDE);
mainWindow = new CMainWindow();
mainWindow->InitializeWindow();
strcpy(mainWindow->m_currentDir, currentDir);
mainWindow->Create((UINT)IDD_ALTACAST, AfxGetMainWnd());
int x = getLastX();
int y = getLastY();
if (x < 0) {
x = 0;
}
if (y < 0) {
y = 0;
}
mainWindow->SetWindowPos(NULL, (int)x, (int)y, -1, -1, SWP_NOSIZE | SWP_SHOWWINDOW);
mainWindow->SetIcon(mainApp.LoadIcon(IDR_MAINFRAME), TRUE);
mainWindow->ShowWindow(SW_SHOW);
initializealtacast();
timerId = SetTimer(NULL, 1, 1000, (TIMERPROC)getCurrentSongTitle);
return 0;
}
示例11: OnInitDialog
BOOL CCWBkImgPage::OnInitDialog()
{
CPropertyPage::OnInitDialog();
// take over bk img from Cover (only the first time!
// that's why this code stands here in OnInitDialog!)
CBackgroundInfo* pBkInfoCover = &((CCreationWizard*) GetParent ())->GetBackgroundInfo (Cover);
if (pBkInfoCover != NULL)
{
if ((m_nBkImageType != Cover) && (m_pBackgroundInfo == NULL))
{
SetDlgItemText (IDC_EDIT_BKIMGFILENAME, pBkInfoCover->GetImageFilename ());
if (!pBkInfoCover->GetImageFilename ().IsEmpty ())
OnButtonPreview ();
}
}
m_BrowseBkImg.SetIcon (m_hIconBrowse);
m_btnScan.SetIcon (m_hIconScan);
CWinApp* pApp = AfxGetApp ();
GetDlgItem (IDC_RADIO1)->SendMessage (BM_SETIMAGE, IMAGE_ICON, (LPARAM) (m_hIconTL = pApp->LoadIcon (IDI_ICON_TL)));
GetDlgItem (IDC_RADIO2)->SendMessage (BM_SETIMAGE, IMAGE_ICON, (LPARAM) (m_hIconTC = pApp->LoadIcon (IDI_ICON_TC)));
GetDlgItem (IDC_RADIO3)->SendMessage (BM_SETIMAGE, IMAGE_ICON, (LPARAM) (m_hIconTR = pApp->LoadIcon (IDI_ICON_TR)));
GetDlgItem (IDC_RADIO4)->SendMessage (BM_SETIMAGE, IMAGE_ICON, (LPARAM) (m_hIconCL = pApp->LoadIcon (IDI_ICON_CL)));
GetDlgItem (IDC_RADIO5)->SendMessage (BM_SETIMAGE, IMAGE_ICON, (LPARAM) (m_hIconCC = pApp->LoadIcon (IDI_ICON_CC)));
GetDlgItem (IDC_RADIO6)->SendMessage (BM_SETIMAGE, IMAGE_ICON, (LPARAM) (m_hIconCR = pApp->LoadIcon (IDI_ICON_CR)));
GetDlgItem (IDC_RADIO7)->SendMessage (BM_SETIMAGE, IMAGE_ICON, (LPARAM) (m_hIconBL = pApp->LoadIcon (IDI_ICON_BL)));
GetDlgItem (IDC_RADIO8)->SendMessage (BM_SETIMAGE, IMAGE_ICON, (LPARAM) (m_hIconBC = pApp->LoadIcon (IDI_ICON_BC)));
GetDlgItem (IDC_RADIO9)->SendMessage (BM_SETIMAGE, IMAGE_ICON, (LPARAM) (m_hIconBR = pApp->LoadIcon (IDI_ICON_BR)));
GetDlgItem (IDC_RADIO5)->SendMessage (BM_SETCHECK, BST_CHECKED, 0);
if (m_pBackgroundInfo != NULL)
{
m_strImgFilename = m_pBackgroundInfo->GetImageFilename ();
if (m_pPic != NULL)
delete m_pPic;
m_pPic = new CPicture (m_strImgFilename);
m_enumMode = m_pBackgroundInfo->GetAlignmentMode ();
UpdateData (false);
}
m_btnSetTransparent.SetIcon (m_hIconSetTransparent);
m_btnRemoveTransparent.SetIcon (m_hIconRemoveTransparent);
m_StaticTransparentCol.SetAngle (0);
if (m_pPic != NULL)
m_pPic->SetTransparentColor (m_crTransparent);
// CG: The following block was added by the ToolTips component.
{
// Create the ToolTip control.
m_tooltip.Create(this);
m_tooltip.Activate(TRUE);
// TODO: Use one of the following forms to add controls:
// m_tooltip.AddTool(GetDlgItem(IDC_<name>), <string-table-id>);
// m_tooltip.AddTool(GetDlgItem(IDC_<name>), "<text>");
m_tooltip.AddTool (&m_BrowseBkImg, IDS_TT_BROWSE);
m_tooltip.AddTool (&m_btnScan, IDS_TT_SCAN);
m_tooltip.AddTool (&m_btnSetTransparent, IDS_TT_TRANSPARENT);
m_tooltip.AddTool (&m_btnRemoveTransparent, IDS_TT_REMOVETRANSPARENT);
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}