这篇教程C++ AfxFindResourceHandle函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中AfxFindResourceHandle函数的典型用法代码示例。如果您正苦于以下问题:C++ AfxFindResourceHandle函数的具体用法?C++ AfxFindResourceHandle怎么用?C++ AfxFindResourceHandle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了AfxFindResourceHandle函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: ASSERTvoid CToolBarEx::SetIconOptions( EIconOptions eIconOptions, bool bUpdate /*=true*/ ){ ASSERT( ::IsWindow( m_hWnd ) ); ASSERT( IsIconOptionAvailable( eIconOptions ) ); m_eIconOptions = eIconOptions; // Set image list(s) and icon size for selected icon options CToolBarCtrl& tbCtrl = GetToolBarCtrl(); tbCtrl.SetImageList( 0 ); tbCtrl.SetHotImageList( 0 ); tbCtrl.SetDisabledImageList( 0 ); CSize szIcon = ( eIconOptions == ioSmallIcons ) ? m_szImageSmall : m_szImageLarge; VERIFY( tbCtrl.SetBitmapSize( szIcon ) ); UINT nIDCold = ( eIconOptions == ioSmallIcons ) ? m_nIDSmallCold : m_nIDLargeCold; UINT nIDHot = ( eIconOptions == ioSmallIcons ) ? m_nIDSmallHot : m_nIDLargeHot; UINT nIDDisabled = ( eIconOptions == ioSmallIcons ) ? m_nIDSmallDisabled : m_nIDLargeDisabled; ASSERT( nIDCold != ( UINT )-1 ); // at least there must be "cold" imagelist LPCTSTR lpResName = MAKEINTRESOURCE( nIDCold ); HINSTANCE hInst = AfxFindResourceHandle( lpResName, RT_BITMAP ); m_imageListCold.DeleteImageList(); VERIFY( m_imageListCold.Attach( ImageList_LoadImage( hInst, lpResName, szIcon.cx, 0, m_clrMask, IMAGE_BITMAP, LR_CREATEDIBSECTION ) ) ); tbCtrl.SetImageList( &m_imageListCold ); if ( nIDHot != ( UINT )-1 ) // "hot" imagelist is optional { lpResName = MAKEINTRESOURCE( nIDHot ); hInst = AfxFindResourceHandle( lpResName, RT_BITMAP ); m_imageListHot.DeleteImageList(); VERIFY( m_imageListHot.Attach( ImageList_LoadImage( hInst, lpResName, szIcon.cx, 0, m_clrMask, IMAGE_BITMAP, LR_CREATEDIBSECTION ) ) ); tbCtrl.SetHotImageList( &m_imageListHot ); } if ( nIDDisabled != ( UINT )-1 ) // "disabled" imagelist is optional { lpResName = MAKEINTRESOURCE( nIDDisabled ); hInst = AfxFindResourceHandle( lpResName, RT_BITMAP ); m_imageListDisabled.DeleteImageList(); VERIFY( m_imageListDisabled.Attach( ImageList_LoadImage( hInst, lpResName, szIcon.cx, 0, m_clrMask, IMAGE_BITMAP, LR_CREATEDIBSECTION ) ) ); tbCtrl.SetDisabledImageList( &m_imageListDisabled ); } // If requested, reflect changes immediately if ( bUpdate ) { ReloadButtons(); UpdateParentBandInfo(); }}
开发者ID:moodboom,项目名称:Reusable,代码行数:58,
示例2: AfxFindResourceHandlebool MTrayIcon::AddIcon (unsigned int icon_id, const CString &tip, const CWnd &target){ HINSTANCE inst; HANDLE icon; inst = AfxFindResourceHandle(MAKEINTRESOURCE(icon_id), RT_GROUP_ICON); icon = LoadImage(inst, MAKEINTRESOURCE(icon_id), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); m_nid.hWnd = target; m_nid.uID = icon_id; m_nid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP; //m_nid.uCallbackMessage = WM_TASKBAR; // my user message m_nid.hIcon = (HICON)icon; if (tip.GetLength() > 0) { lstrcpyn(m_nid.szTip, tip, sizeof(m_nid.szTip)); } else { m_nid.szTip[0] = '/0'; } Shell_NotifyIcon(NIM_ADD, &m_nid); return true; // No errors.}
开发者ID:BackupTheBerlios,项目名称:miraledon,代码行数:25,
示例3: AfxFindResourceHandleBOOL CMPCPngImage::Load(LPCTSTR lpszResourceName, HINSTANCE hinstRes){ if (hinstRes == nullptr) { hinstRes = AfxFindResourceHandle(lpszResourceName, _T("PNG")); } HRSRC hRsrc = ::FindResource(hinstRes, lpszResourceName, _T("PNG")); if (hRsrc == nullptr) { // Fallback to the instance handle hinstRes = AfxGetInstanceHandle(); hRsrc = ::FindResource(hinstRes, lpszResourceName, _T("PNG")); if (hRsrc == nullptr) { return FALSE; } } HGLOBAL hGlobal = LoadResource(hinstRes, hRsrc); if (hGlobal == nullptr) { return FALSE; } LPVOID lpBuffer = ::LockResource(hGlobal); if (lpBuffer == nullptr) { FreeResource(hGlobal); return FALSE; } BOOL bRes = LoadFromBuffer((LPBYTE) lpBuffer, (UINT) ::SizeofResource(hinstRes, hRsrc)); UnlockResource(hGlobal); FreeResource(hGlobal); return bRes;}
开发者ID:Murder66,项目名称:mpc-hc-master,代码行数:34,
示例4: AfxFindResourceHandle// This function associates a menu to the button.// The menu will be displayed clicking the button.//// Parameters:// [IN] nMenu// ID number of the menu resource.// Pass NULL to remove any menu from the button.// [IN] hParentWnd// Handle to the window that owns the menu.// This window receives all messages from the menu.// [IN] bRepaint// If TRUE the control will be repainted.//// Return value:// BTNST_OK// Function executed successfully.// BTNST_INVALIDRESOURCE// Failed loading the specified resource.//DWORD CButtonST::SetMenu(UINT nMenu, HWND hParentWnd, BOOL bRepaint){ HINSTANCE hInstResource = NULL; // Destroy any previous menu if (m_hMenu) { ::DestroyMenu(m_hMenu); m_hMenu = NULL; m_hParentWndMenu = NULL; m_bMenuDisplayed = FALSE; } // if // Load menu if (nMenu) { // Find correct resource handle hInstResource = AfxFindResourceHandle(MAKEINTRESOURCE(nMenu), RT_MENU); // Load menu resource m_hMenu = ::LoadMenu(hInstResource, MAKEINTRESOURCE(nMenu)); m_hParentWndMenu = hParentWnd; // If something wrong if (m_hMenu == NULL) return BTNST_INVALIDRESOURCE; } // if // Repaint the button if (bRepaint) Invalidate(); return BTNST_OK;} // End of SetMenu
开发者ID:darwinbeing,项目名称:trade,代码行数:49,
示例5: AfxFindResourceHandle_AFX_OCC_DIALOG_INFO* CFormView::GetOccDialogInfo(){#ifndef _AFX_NO_OCC_SUPPORT if (m_pOccDialogInfo == NULL && m_lpszTemplateName != NULL) { LPCDLGTEMPLATE lpDialogTemplate = NULL; HINSTANCE hInst = AfxFindResourceHandle(m_lpszTemplateName, RT_DIALOG); HRSRC hResource = ::FindResource(hInst, m_lpszTemplateName, RT_DIALOG); HGLOBAL hTemplate = LoadResource(hInst, hResource); if (hTemplate != NULL) { lpDialogTemplate = (LPCDLGTEMPLATE)LockResource(hTemplate); if (lpDialogTemplate != NULL) { COccManager* pOccManager = afxOccManager; if (pOccManager != NULL) { _AFX_OCC_DIALOG_INFO *pOccDialogInfo = new _AFX_OCC_DIALOG_INFO; lpDialogTemplate = pOccManager->PreCreateDialog(pOccDialogInfo, lpDialogTemplate); m_pOccDialogInfo = pOccDialogInfo; } } } }#endif return m_pOccDialogInfo; }
开发者ID:pixelspark,项目名称:corespark,代码行数:29,
示例6: RemoveSystemTrayIcon/** * set the old icon in system tray */void CPocketSMDlg::SetOldTrayIcon() { RemoveSystemTrayIcon(); // handle to icon HICON hIcon; HINSTANCE hInst = AfxFindResourceHandle(MAKEINTRESOURCE(IDR_MAINFRAME), RT_GROUP_ICON); hIcon = (HICON)LoadImage( hInst, MAKEINTRESOURCE(IDR_MAINFRAME), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); // set NOTIFYCONDATA structure m_nidIconData.cbSize = sizeof(NOTIFYICONDATA); m_nidIconData.hWnd = m_hWnd; m_nidIconData.uID = IDR_MAINFRAME; m_nidIconData.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP; m_nidIconData.uCallbackMessage = WM_ICON_NOTIFY; // my user message m_nidIconData.hIcon = hIcon; m_nidIconData.szTip[0] = '/0'; // call to Shell_NotifyIcon with NIM_ADD parameter Shell_NotifyIcon(NIM_ADD, &m_nidIconData); // free icon if (hIcon) DestroyIcon(hIcon); }
开发者ID:BackupTheBerlios,项目名称:pocketsipmsg-svn,代码行数:38,
示例7: ASSERTbool CDockingBar::Create(CWnd* parent, CFramePages* pages, bool show){ ASSERT(parent); ASSERT(pages); pages_ = pages; if (wnd_class_.IsEmpty()) wnd_class_ = AfxRegisterWndClass(CS_VREDRAW | CS_HREDRAW, ::LoadCursor(NULL, IDC_ARROW)); CDC dc; dc.CreateIC(_T("DISPLAY"), 0, 0, 0); dc.SelectStockObject(DEFAULT_GUI_FONT); TEXTMETRIC tm; dc.GetTextMetrics(&tm); int line_height= tm.tmHeight + tm.tmInternalLeading + tm.tmExternalLeading; int bar_height= ((line_height + 6) & ~1) + 1; // ensure height is odd // create docking bar; width will be reset by frame wnd if (!CWnd::CreateEx(0, wnd_class_, _T(""), WS_CHILD | (show ? WS_VISIBLE : 0) | WS_CLIPCHILDREN, CRect(0, 0, 200, bar_height), parent, -1)) return false; HINSTANCE inst= AfxFindResourceHandle(MAKEINTRESOURCE(IDB_DOCK_BAR), RT_BITMAP); image_list_.Attach(ImageList_LoadImage(inst, MAKEINTRESOURCE(IDB_DOCK_BAR), 16, 0, RGB(192,192,192), IMAGE_BITMAP, LR_CREATEDIBSECTION)); image_list_.SetBkColor(CLR_NONE); Refresh(true); return true;}
开发者ID:mikekov,项目名称:ExifPro,代码行数:33,
示例8: AfxFindResourceHandlevoid CSkinBtn::SetIcons(CString strMouseOut,CString strMouseIn,BOOL bDrawIcon){// m_hMouseOutIcon.Load(strMouseOut);// m_hMouseInIcon.Load(strMouseIn); HICON hIconIn = NULL; HICON hIconOut = NULL; HINSTANCE hInstResource = NULL; // Find correct resource handle hInstResource = AfxFindResourceHandle(MAKEINTRESOURCE(hIconIn), RT_GROUP_ICON); // Set icon when the mouse is IN the button hIconIn = (HICON)::LoadImage(hInstResource, strMouseIn, IMAGE_ICON, 0, 0, 0); // Set icon when the mouse is OUT the button if (strMouseOut) { // if (hIconOut == (int)BTNST_AUTO_GRAY) // hIconOut = BTNST_AUTO_GRAY; // else hIconOut = (HICON)::LoadImage(hInstResource, strMouseOut, IMAGE_ICON, 0, 0, 0); } // if m_IconIn = hIconIn; m_IconOut = hIconOut; m_IconDraw = bDrawIcon;}
开发者ID:alucard263096,项目名称:AMK,代码行数:27,
示例9: AttachBOOL CImageList::Create(LPCTSTR lpszBitmapID, int cx, int nGrow, COLORREF crMask){ return Attach(ImageList_LoadBitmap( AfxFindResourceHandle(lpszBitmapID, RT_BITMAP), lpszBitmapID, cx, nGrow, crMask));}
开发者ID:rickerliang,项目名称:OpenNT,代码行数:7,
示例10: ASSERTBOOL CDialog::Create(LPCTSTR lpszTemplateName, CWnd* pParentWnd){ ASSERT(HIWORD(lpszTemplateName) == 0 || AfxIsValidString(lpszTemplateName)); m_lpszTemplateName = lpszTemplateName; // used for help if (HIWORD(m_lpszTemplateName) == 0 && m_nIDHelp == 0) m_nIDHelp = LOWORD((DWORD)m_lpszTemplateName);#ifdef _DEBUG if (!_AfxCheckDialogTemplate(lpszTemplateName, FALSE)) { ASSERT(FALSE); // invalid dialog template name PostNcDestroy(); // cleanup if Create fails too soon return FALSE; }#endif //_DEBUG HINSTANCE hInst = AfxFindResourceHandle(lpszTemplateName, RT_DIALOG); HRSRC hResource = ::FindResource(hInst, lpszTemplateName, RT_DIALOG); HGLOBAL hTemplate = LoadResource(hInst, hResource); BOOL bResult = CreateIndirect(hTemplate, pParentWnd, hInst); FreeResource(hTemplate); return bResult;}
开发者ID:anyue100,项目名称:winscp,代码行数:26,
示例11: AfxFindResourceHandleBOOL CExtButton::SetBtnCursor(int nCursorId){HINSTANCE hInstResource; if( m_hCursor != NULL ) ::DestroyCursor(m_hCursor); m_hCursor = NULL; if( nCursorId != -1 ) { hInstResource = AfxFindResourceHandle( MAKEINTRESOURCE(nCursorId), RT_GROUP_CURSOR ); m_hCursor = (HCURSOR)::LoadImage( hInstResource, MAKEINTRESOURCE(nCursorId), IMAGE_CURSOR, 0, 0, 0 ); if( m_hCursor == NULL ) return FALSE; } return TRUE;}
开发者ID:darwinbeing,项目名称:trade,代码行数:27,
示例12: AfxFindResourceHandleCChildFrame::CChildFrame(){ // TODO: add member initialization code here m_hChildFrameIcon = NULL;HINSTANCE hInstResource = AfxFindResourceHandle( MAKEINTRESOURCE(IDR_MDITYPE), RT_GROUP_ICON ); ASSERT( hInstResource != NULL ); if( hInstResource != NULL ) { m_hChildFrameIcon = (HICON)::LoadImage( hInstResource, MAKEINTRESOURCE(IDR_MDITYPE), IMAGE_ICON, 16, 16, 0 ); ASSERT( m_hChildFrameIcon != NULL ); }}
开发者ID:ngphloc,项目名称:agmagic,代码行数:25,
示例13: ScreenToClientBOOL CPreviewView::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message){ if (nHitTest != HTCLIENT) return CScrollView::OnSetCursor(pWnd, nHitTest, message); CPoint point; ::GetCursorPos(&point); ScreenToClient(&point); // client coordinates of mouse position UINT nPage; if (m_nZoomState != ZOOM_IN && FindPageRect(point, nPage)) { // On a page and not zoomed all the way in if (m_hMagnifyCursor == NULL) { HINSTANCE hInst = AfxFindResourceHandle( MAKEINTRESOURCE(AFX_IDC_MAGNIFY), RT_GROUP_CURSOR); m_hMagnifyCursor = ::LoadCursor(hInst, MAKEINTRESOURCE(AFX_IDC_MAGNIFY)); } ::SetCursor(m_hMagnifyCursor); } else { ::SetCursor(::LoadCursor(NULL, IDC_ARROW)); } return 0;}
开发者ID:rickerliang,项目名称:OpenNT,代码行数:27,
示例14: AfxFindResourceHandleBOOL CButtonST::SetBtnCursor(int nCursorId){ HINSTANCE hInstResource; // Destroy any previous cursor if (m_hCursor != NULL) { ::DestroyCursor(m_hCursor); } m_hCursor = NULL; // If we want a cursor if (nCursorId != NULL) { hInstResource = AfxFindResourceHandle(MAKEINTRESOURCE(nCursorId), RT_GROUP_CURSOR); // Load icon resource m_hCursor = (HCURSOR)::LoadImage(hInstResource/*AfxGetApp()->m_hInstance*/, MAKEINTRESOURCE(nCursorId), IMAGE_CURSOR, 0, 0, 0); // If something wrong then return FALSE if (m_hCursor == NULL) { return FALSE; } } return TRUE;} // End of SetBtnCursor
开发者ID:jiangchengxu,项目名称:spreadtrum-w160,代码行数:27,
示例15: sizeofint CChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CMDIChildWnd::OnCreate(lpCreateStruct) == -1) return -1; int iIndicatCount = sizeof(indicators)/sizeof(UINT); if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, iIndicatCount)) return -1; m_wndStatusBar.SetPaneStyle(0, m_wndStatusBar.GetPaneStyle(0) | SBPS_STRETCH); int i; for (i = 1; i < iIndicatCount; i++) { m_wndStatusBar.SetPaneInfo(i, indicators[i], m_wndStatusBar.GetPaneStyle(i), 16); m_wndStatusBar.SetPaneText(i, NULL); } m_progress.Create(this, NULL, 100, 1, TRUE); UINT icons [] = {IDI_MODIFIED,IDI_READONLY,IDI_REPORT,IDI_MULTIDISK, IDI_EXCEPT}; ASSERT(sizeof (m_icons) / sizeof (HICON) == sizeof (icons) / sizeof (UINT)); HINSTANCE hInst = AfxFindResourceHandle(MAKEINTRESOURCE(IDR_MAINFRAME),RT_GROUP_ICON); for (i = 0; i < sizeof (m_icons) / sizeof (HICON); i++) m_icons[i] = (HICON)LoadImage(hInst,MAKEINTRESOURCE(icons[i]),IMAGE_ICON,16,16,LR_DEFAULTCOLOR); return 0;}
开发者ID:RandallFlagg,项目名称:kgbarchiver,代码行数:25,
示例16: _AfxCheckDialogTemplate// diagnostic routine to check for and decode dialog templates// return FALSE if a program error occurs (i.e. bad resource ID or// bad dialog styles).BOOL AFXAPI _AfxCheckDialogTemplate(LPCTSTR lpszResource, BOOL bInvisibleChild){ ASSERT(lpszResource != NULL); HINSTANCE hInst = AfxFindResourceHandle(lpszResource, RT_DIALOG); HRSRC hResource = ::FindResource(hInst, lpszResource, RT_DIALOG); if (hResource == NULL) { if (HIWORD(lpszResource) != 0) TRACE1("ERROR: Cannot find dialog template named '%s'./n", lpszResource); else TRACE1("ERROR: Cannot find dialog template with IDD 0x%04X./n", LOWORD((DWORD)lpszResource)); return FALSE; } if (!bInvisibleChild) return TRUE; // that's all we need to check // we must check that the dialog template is for an invisible child // window that can be used for a form-view or dialog-bar HGLOBAL hTemplate = LoadResource(hInst, hResource); if (hTemplate == NULL) { TRACE0("Warning: LoadResource failed for dialog template./n"); // this is only a warning, the real call to CreateDialog will fail return TRUE; // not a program error - just out of memory } DLGTEMPLATEEX* pTemplate = (DLGTEMPLATEEX*)LockResource(hTemplate); DWORD dwStyle; if (pTemplate->signature == 0xFFFF) dwStyle = pTemplate->style; else dwStyle = ((DLGTEMPLATE*)pTemplate)->style; UnlockResource(hTemplate); FreeResource(hTemplate); if (dwStyle & WS_VISIBLE) { if (HIWORD(lpszResource) != 0) TRACE1("ERROR: Dialog named '%s' must be invisible./n", lpszResource); else TRACE1("ERROR: Dialog with IDD 0x%04X must be invisible./n", LOWORD((DWORD)lpszResource)); return FALSE; } if (!(dwStyle & WS_CHILD)) { if (HIWORD(lpszResource) != 0) TRACE1("ERROR: Dialog named '%s' must have the child style./n", lpszResource); else TRACE1("ERROR: Dialog with IDD 0x%04X must have the child style./n", LOWORD((DWORD)lpszResource)); return FALSE; } return TRUE;}
开发者ID:anyue100,项目名称:winscp,代码行数:63,
示例17: ASSERTBOOL CImageList::Create(UINT nBitmapID, int cx, int nGrow, COLORREF crMask){ ASSERT(HIWORD(nBitmapID) == 0); return Attach(ImageList_LoadBitmap( AfxFindResourceHandle((LPCTSTR)nBitmapID, RT_BITMAP), (LPCTSTR)nBitmapID, cx, nGrow, crMask));}
开发者ID:rickerliang,项目名称:OpenNT,代码行数:7,
示例18: AfxFindResourceHandleBOOL COccManager::CreateDlgControls(CWnd* pWndParent, LPCTSTR lpszResourceName, _AFX_OCC_DIALOG_INFO* pOccDlgInfo){ // find resource handle void* lpResource = NULL; HGLOBAL hResource = NULL; if (lpszResourceName != NULL) { HINSTANCE hInst = AfxFindResourceHandle(lpszResourceName, RT_DLGINIT); HRSRC hDlgInit = ::FindResource(hInst, lpszResourceName, RT_DLGINIT); if (hDlgInit != NULL) { // load it hResource = LoadResource(hInst, hDlgInit); if (hResource == NULL) { TRACE0("DLGINIT resource was found, but could not be loaded./n"); return FALSE; } // lock it lpResource = LockResource(hResource); ASSERT(lpResource != NULL); }#ifdef _DEBUG else { // If we didn't find a DLGINIT resource, check whether we were // expecting to find one DLGITEMTEMPLATE** ppOleDlgItems = pOccDlgInfo->m_ppOleDlgItems; ASSERT(ppOleDlgItems != NULL); while (*ppOleDlgItems != (DLGITEMTEMPLATE*)-1) { if (*ppOleDlgItems != NULL) { TRACE0("Dialog has OLE controls, but no matching DLGINIT resource./n"); break; } ++ppOleDlgItems; } }#endif } // execute it BOOL bResult = TRUE; if (lpResource != NULL) bResult = CreateDlgControls(pWndParent, lpResource, pOccDlgInfo); // cleanup if (lpResource != NULL && hResource != NULL) { UnlockResource(hResource); FreeResource(hResource); } return bResult;}
开发者ID:rickerliang,项目名称:OpenNT,代码行数:59,
示例19: AfxFindResourceHandleBOOL CFrameWnd::LoadAccelTable( LPCTSTR lpszResourceName )/********************************************************/{ HINSTANCE hInstance = AfxFindResourceHandle( lpszResourceName, RT_ACCELERATOR ); ASSERT( m_hAccelTable == NULL ); m_hAccelTable = ::LoadAccelerators( hInstance, lpszResourceName ); return( m_hAccelTable != NULL );}
开发者ID:ArmstrongJ,项目名称:open-watcom-v2,代码行数:8,
示例20: AfxThrowOleDispatchExceptionvoid AFXAPI AfxThrowOleDispatchException( WORD wCode, UINT nDescriptionID, UINT nHelpID )/***************************************************************************************/{ TCHAR szDescription[1024]; HINSTANCE hInstance = AfxFindResourceHandle( MAKEINTRESOURCE( nDescriptionID ), RT_STRING ); ::LoadString( hInstance, nDescriptionID, szDescription, 1024 ); throw new COleDispatchException( szDescription, nHelpID, wCode );}
开发者ID:ArmstrongJ,项目名称:open-watcom-v2,代码行数:8,
示例21: AfxFindResourceHandlevoid CWinApp::SetRegistryKey( UINT nIDRegistryKey )/*************************************************/{ TCHAR szBuff[256]; HINSTANCE hInstance = AfxFindResourceHandle( MAKEINTRESOURCE( nIDRegistryKey ), RT_STRING ); ::LoadString( hInstance, nIDRegistryKey, szBuff, 256 ); SetRegistryKey( szBuff );}
开发者ID:ArmstrongJ,项目名称:open-watcom-v2,代码行数:8,
示例22: AfxFindResourceHandleBOOL CSkinBase::ExtractResource(UINT nID, LPCTSTR szType, CString& sTempFilePath, HINSTANCE hInst){ if (!hInst) hInst = AfxFindResourceHandle(MAKEINTRESOURCE(nID), szType); if (!hInst) return FALSE; // compare time with that of module from which it was loaded CString sTempPath; CFileStatus fsRes, fsModule; CString sModulePath; ::GetModuleFileName(hInst, sModulePath.GetBuffer(MAX_PATH + 1), MAX_PATH); sModulePath.ReleaseBuffer(); if (!CFile::GetStatus(sModulePath, fsModule)) return FALSE; // create temp filename ::GetTempPath(MAX_PATH, sTempPath.GetBuffer(MAX_PATH)); sTempPath.ReleaseBuffer(); sTempFilePath.Format("%s%s_skin_%d.tmp", sTempPath, szType, nID); // see if the file has been created before if (!CFile::GetStatus(sTempFilePath, fsRes) || fsRes.m_mtime < fsModule.m_mtime) { // Load the resource into memory HRSRC hRes = FindResource(hInst, (LPCSTR)nID, szType); if (!hRes) { TRACE("Couldn't find %s resource %d!/n", szType, nID); return FALSE; } DWORD len = SizeofResource(hInst, hRes); BYTE* lpRes = (BYTE*)LoadResource(hInst, hRes); ASSERT(lpRes); CFile file; if (file.Open(sTempFilePath, CFile::modeCreate | CFile::modeWrite)) { file.Write(lpRes, len); file.Close(); FreeResource((HANDLE)lpRes); } else { FreeResource((HANDLE)lpRes); return FALSE; } } return TRUE;}
开发者ID:3rdexp,项目名称:jezzitest,代码行数:57,
示例23: ifBOOL ZSplitter::OnSetCursor( CWnd* pWnd, UINT nHitTest, UINT message ){ if ( pWnd==this && nHitTest==HTCLIENT ) { static int _afx_idcPrimaryLast = 0; static HCURSOR _afx_hcurLast = NULL; static HCURSOR _afx_hcurDestroy = 0; int idcPrimary = 0; if(ownStyle==sp_StyleRect) { idcPrimary = AFX_IDC_SMALLARROWS; } else if(ownStyle==sp_StyleHoriz) { idcPrimary = AFX_IDC_HSPLITBAR; } else if(ownStyle==sp_StyleVert) { idcPrimary = AFX_IDC_VSPLITBAR; } if (idcPrimary != 0) { HCURSOR hcurToDestroy = NULL; if (idcPrimary != _afx_idcPrimaryLast) { HINSTANCE hInst = AfxFindResourceHandle(MAKEINTRESOURCE(idcPrimary), RT_GROUP_CURSOR); // load in another cursor hcurToDestroy = _afx_hcurDestroy; // Note: If this LoadCursor call fails, it is likely that // _AFX_NO_SPLITTER_RESOURCES is defined in your .RC file. // To correct the situation, remove the following line from your // resource script: // #define _AFX_NO_SPLITTER_RESOURCES // This should be done using the Resource.Set Includes... command. if ((_afx_hcurDestroy = _afx_hcurLast = ::LoadCursor(hInst, MAKEINTRESOURCE(idcPrimary))) == NULL) { TRACE0("Warning: Could not find splitter cursor - using system provided alternative./n"); return CWnd::OnSetCursor(pWnd,nHitTest,message); } _afx_idcPrimaryLast = idcPrimary; } ASSERT(_afx_hcurLast != NULL); ::SetCursor(_afx_hcurLast); ASSERT(_afx_hcurLast != hcurToDestroy); if (hcurToDestroy != NULL) ::DestroyCursor(hcurToDestroy); // destroy after being set } return true; } return CWnd::OnSetCursor(pWnd,nHitTest,message);}
开发者ID:CuteThalia,项目名称:FPS-Creator-Classic,代码行数:56,
示例24: AfxFindResourceHandlevoid CIDAStarStatic::OnMouseHover(UINT nFlags, CPoint point){ // TODO: 在此添加消息处理程序代码和/或调用默认值 HINSTANCE hIns = AfxFindResourceHandle(MAKEINTRESOURCE(IDB_BITMAP_IDASTAR_CLICK), RT_GROUP_ICON); HBITMAP hBmp = ::LoadBitmap(hIns, MAKEINTRESOURCE(IDB_BITMAP_IDASTAR_CLICK)); SetBitmap(hBmp); CStatic::OnMouseHover(nFlags, point);}
开发者ID:BIGBALLON,项目名称:Ghost,代码行数:10,
示例25: AfxFindResourceHandlebool CSTATUS_DIALOG::create_dialog(){ //Load DLGTEMPLATE DLGTEMPLATE* pTemplate; HINSTANCE hInst= AfxFindResourceHandle( MAKEINTRESOURCE(IDD_DIALOG_STATUS),RT_DIALOG); if (hInst == NULL) { TRACE("Cound not find resource in resource chain"); ASSERT(FALSE); return true; } HRSRC hRsrc = ::FindResource(hInst, MAKEINTRESOURCE(IDD_DIALOG_STATUS), RT_DIALOG); ASSERT(hRsrc != NULL); HGLOBAL hTemplate = ::LoadResource(hInst, hRsrc); ASSERT(hTemplate != NULL); pTemplate = (DLGTEMPLATE*)::LockResource(hTemplate); //Load coresponding DLGINIT resource void* lpDlgInit = NULL; HGLOBAL hDlgInit = NULL; HRSRC hsDlgInit = ::FindResource(hInst, MAKEINTRESOURCE(IDD_DIALOG_STATUS), RT_DLGINIT); if (hsDlgInit != NULL) { // load it hDlgInit = ::LoadResource(hInst, hsDlgInit); ASSERT(hDlgInit != NULL); // lock it lpDlgInit = ::LockResource(hDlgInit); ASSERT(lpDlgInit != NULL); } //ToDo: Modify DLGTEMPLATE in memory if desired CreateIndirect(hTemplate, NULL, hInst); ::UnlockResource(hTemplate); ::FreeResource(hTemplate); if (hDlgInit) { ::UnlockResource(hDlgInit); ::FreeResource(hDlgInit); } return true;}
开发者ID:liquanhai,项目名称:cxm-hitech-matrix428,代码行数:55,
示例26: OnExecute// If the button in the command bar is clicked, then this function will be called// virtual BOOL UC_ViewRotateCmd::OnExecute(){ BOOL bOK = FW_Cmd::OnExecute(); if(!bOK) return FALSE; m_bStart = false; m_hCursor = ::LoadCursor(AfxFindResourceHandle(MAKEINTRESOURCE(IDC_UC_VIEW_ROTATE),RT_GROUP_CURSOR), MAKEINTRESOURCE(IDC_UC_VIEW_ROTATE)); return TRUE;}
开发者ID:KnowNo,项目名称:backup,代码行数:13,
示例27: ASSERT_VALID//*****************************************************************************BOOL CBCGPRibbonStatusBarPane::SetAnimationList (UINT uiAnimationListResID, int cxAnimation, COLORREF clrTransp, BOOL bDontScaleInHighDPIMode){ ASSERT_VALID (this); if (m_AnimImages.IsValid ()) { m_AnimImages.Clear (); } if (uiAnimationListResID == 0) { return TRUE; } LPCTSTR lpszResourceName = MAKEINTRESOURCE (uiAnimationListResID); ASSERT(lpszResourceName != NULL); HBITMAP hbmp = NULL; //----------------------------- // Try to load PNG image first: //----------------------------- CBCGPPngImage pngImage; if (pngImage.Load (lpszResourceName)) { hbmp = (HBITMAP) pngImage.Detach (); } else { HINSTANCE hinstRes = AfxFindResourceHandle (lpszResourceName, RT_BITMAP); if (hinstRes == NULL) { return FALSE; } UINT uiLoadImageFlags = LR_CREATEDIBSECTION | LR_LOADMAP3DCOLORS; hbmp = (HBITMAP) ::LoadImage ( hinstRes, lpszResourceName, IMAGE_BITMAP, 0, 0, uiLoadImageFlags); } if (hbmp == NULL) { return FALSE; } SetAnimationList (hbmp, cxAnimation, clrTransp, bDontScaleInHighDPIMode); return TRUE;}
开发者ID:iclosure,项目名称:jframework,代码行数:55,
注:本文中的AfxFindResourceHandle函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ AfxFormatString1函数代码示例 C++ AfxExtractSubString函数代码示例 |