• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ AfxFindResourceHandle函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中AfxFindResourceHandle函数的典型用法代码示例。如果您正苦于以下问题:C++ AfxFindResourceHandle函数的具体用法?C++ AfxFindResourceHandle怎么用?C++ AfxFindResourceHandle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: ASSERT

void 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,代码来源:ToolBarEx.cpp


示例2: AfxFindResourceHandle

bool 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,代码来源:TrayIcon.cpp


示例3: AfxFindResourceHandle

BOOL 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,代码来源:MPCPngImage.cpp


示例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,代码来源:BtnST.cpp


示例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,代码来源:viewform.cpp


示例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,代码来源:PocketSMDlg.cpp


示例7: ASSERT

bool 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,代码来源:DockingBar.cpp


示例8: AfxFindResourceHandle

void 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,代码来源:SkinBtn.cpp


示例9: Attach

BOOL 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,代码来源:winctrl2.cpp


示例10: ASSERT

BOOL 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,代码来源:dlgcore.cpp


示例11: AfxFindResourceHandle

BOOL 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,代码来源:ExtButton.cpp


示例12: AfxFindResourceHandle

CChildFrame::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,代码来源:ChildFrm.cpp


示例13: ScreenToClient

BOOL 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,代码来源:viewprev.cpp


示例14: AfxFindResourceHandle

BOOL 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,代码来源:BtnST.cpp


示例15: sizeof

int 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,代码来源:ChildFrm.cpp


示例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,代码来源:dlgcore.cpp


示例17: ASSERT

BOOL 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,代码来源:winctrl2.cpp


示例18: AfxFindResourceHandle

BOOL 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,代码来源:occmgr.cpp


示例19: AfxFindResourceHandle

BOOL 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,代码来源:framewnd.cpp


示例20: AfxThrowOleDispatchException

void 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,代码来源:oledispx.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ AfxFormatString1函数代码示例发布时间:2022-05-30
下一篇:
C++ AfxExtractSubString函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap