本文整理汇总了C++中AfxSetResourceHandle函数的典型用法代码示例。如果您正苦于以下问题:C++ AfxSetResourceHandle函数的具体用法?C++ AfxSetResourceHandle怎么用?C++ AfxSetResourceHandle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AfxSetResourceHandle函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AfxGetApp
BOOL CParticleEditor::Initialize( )
{
CWinApp* pApp = AfxGetApp();
ASSERT(pApp != NULL);
if (pApp == NULL)
{
return FALSE;
}
// get the apps instance handle for loading resources
m_AppInst = AfxGetResourceHandle();
//Direct the application to look in dll for resources
AfxSetResourceHandle(ParticleEditorDLL.hModule);
// use my string / icon resources
// Note IDR_EXAMPLETYPE has to be a unique id even between DLLS
// to get the ICONS right on the Window
m_DocTemplate = new CMultiDocTemplate(IDR_PARTICLETYPE,
RUNTIME_CLASS(CParticleDoc),
RUNTIME_CLASS(CParticleFrame),
RUNTIME_CLASS(CParticleRenderView));
// put this after setting the menu and accelerators so it won't allocate it's own
pApp->AddDocTemplate(m_DocTemplate);
// construct resource info
m_ObjCollection.name.LoadString(IDS_RESOURCE_NAME);
m_ObjCollection.pageIndex = &m_PageIndex;
m_ObjCollection.hIcon = (HICON)LoadImage(ParticleEditorDLL.hModule, MAKEINTRESOURCE(IDR_PARTICLETYPE),
IMAGE_ICON, 0, 0, LR_CREATEDIBSECTION);
VERIFY(m_ObjCollection.hIcon != NULL);
// value should be 1 - 1000
// NOTE: Against convention this was set at coding to 31000 even the example is set at 5000
m_ObjCollection.priority = IDR_PARTICLETYPE;
m_ObjCollection.extensions = PARTICLE_EXTENSIONS;
AfxSetResourceHandle(m_AppInst);
return TRUE;
}
示例2: ASSERT
VOID Language::UnInstallRunLanguage()///设置成保存的资源进程
{//卸载资源
// ASSERT(m_hOldInstance!=NULL);
if(m_hOldInstance==NULL)return;
HINSTANCE hInstal;
hInstal=AfxGetResourceHandle();
ASSERT(FreeLibrary(hInstal));
AfxSetResourceHandle(m_hOldInstance);
m_hCurrentInstance=m_hOldInstance;
m_hOldInstance=NULL;
}
示例3: AfxGetResourceHandle
void CMediaVisDlg::OnSetup()
{
int nItem = m_wndList.GetNextItem( -1, LVIS_SELECTED );
if ( nItem < 0 ) return;
CString strCLSID = m_wndList.GetItemText( nItem, 1 );
CString strPath = m_wndList.GetItemText( nItem, 2 );
CLSID pCLSID;
if ( ! Hashes::fromGuid( strCLSID, &pCLSID ) ) return;
if ( ! Plugins.LookupEnable( pCLSID ) ) return;
IAudioVisPlugin* pPlugin = NULL;
if ( Settings.MediaPlayer.VisCLSID == strCLSID &&
Settings.MediaPlayer.VisPath == strPath )
{
IMediaPlayer* pPlayer = ( m_pFrame != NULL ) ? m_pFrame->GetPlayer() : NULL;
if ( pPlayer != NULL )
{
pPlayer->GetPlugin( &pPlugin );
if ( pPlugin != NULL )
{
pPlugin->Configure();
pPlugin->Release();
return;
}
}
}
HINSTANCE hRes = AfxGetResourceHandle();
HRESULT hr = CoCreateInstance( pCLSID, NULL, CLSCTX_ALL, IID_IAudioVisPlugin, (void**)&pPlugin );
AfxSetResourceHandle( hRes );
if ( FAILED( hr ) || pPlugin == NULL ) return;
if ( ! strPath.IsEmpty() )
{
IWrappedPluginControl* pWrap = NULL;
hr = pPlugin->QueryInterface( IID_IWrappedPluginControl, (void**)&pWrap );
if ( SUCCEEDED( hr ) && pWrap != NULL )
{
pWrap->Load( CComBSTR( strPath ), 0 );
pWrap->Release();
}
}
pPlugin->Configure();
pPlugin->Release();
}
示例4: OnInitDialog
virtual BOOL OnInitDialog()
{
AfxSetResourceHandle(m_ResourceDllHandle);
AfxSetResourceHandle(m_ExeHandle);
//call the Trace Dlg and not TabbedBaseTraceDlg because
//the dialogs that are displayed on the tab control
//should be taken from the Exe resources while the trace dialog
//is taken from the Resource Dll
CTraceTabBaseDlg::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
}
示例5: AfxSetResourceHandle
//控件绑定
void CCompanionTreeCtrl::PreSubclassWindow()
{
//加载图片
if (m_ImageList.GetSafeHandle()==NULL)
{
CBitmap TreeImage;
AfxSetResourceHandle(GetModuleHandle(COMPANION_DLL_NAME));
TreeImage.LoadBitmap(IDB_TREE_IMAGE);
AfxSetResourceHandle(GetModuleHandle(NULL));
m_ImageList.Create(18,18,ILC_COLOR16|ILC_MASK,0,0);
m_ImageList.Add(&TreeImage,RGB(255,0,255));
}
SetImageList(&m_ImageList,LVSIL_NORMAL);
//设置控件
SetItemHeight(20);
SetTextColor(RGB(10,10,10));
SetBkColor(RGB(245,255,205));
SendMessage(WN_SET_LINE_COLOR,0,(LPARAM)RGB(69,69,69));
//插入子项
TV_INSERTSTRUCT InsertInf;
memset(&InsertInf,0,sizeof(InsertInf));
InsertInf.item.cchTextMax=128;
InsertInf.hInsertAfter=TVI_LAST;
InsertInf.item.mask=TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_TEXT|TVIF_PARAM;
//游戏好友
InsertInf.item.iImage=IMAGE_FRIEND;
InsertInf.item.iSelectedImage=IMAGE_FRIEND;
InsertInf.item.pszText=TEXT("游戏好友");
m_hItemFriend=InsertItem(&InsertInf);
//厌恶玩家
InsertInf.item.iImage=IMAGE_DETEST;
InsertInf.item.iSelectedImage=IMAGE_DETEST;
InsertInf.item.pszText=TEXT("游戏黑名单");
m_hItemDetest=InsertItem(&InsertInf);
__super::PreSubclassWindow();
}
示例6: CHashString
//---------------------------------------------------------------------
// Function: OnCreate
// Description: Called from the main windows create function
// Parameters: CMDIFrameWnd *mainWnd = main frames CMDIFrameWnd pointer
// Returns: .
//---------------------------------------------------------------------
void CStateMachineEditor::OnCreate(CMDIFrameWnd *mainWnd)
{
MENUINFOMESSAGE mim;
CBitmap menuBitmap;
HINSTANCE appInst;
static DWORD msgHash_GetMenuInfo = CHashString(_T("GetMenuInfo")).GetUniqueID();
m_ToolBox->SendMessage(msgHash_GetMenuInfo, sizeof(MENUINFOMESSAGE), &mim);
// get the apps instance handle for loading resources
appInst = AfxGetResourceHandle();
// now tell the application to look in dll for resources
AfxSetResourceHandle(StateMachineEditorDLL.hModule);
// we need to mergeMenus
VERIFY(MergeMenus(&m_DocTemplate->m_hMenuShared, mim.m_hMenu, _T("&Window")));
// and accelerators
VERIFY(MergeAccelerators(&m_DocTemplate->m_hAccelTable, mim.m_hAccel));
mim.m_hAccel = NULL;
mim.m_hMenu = NULL;
// load up hi-res toolbar icon
//menuBitmap.LoadBitmap(IDB_TOOLBAR);
// we don't really have to have to toolbar visible do we?
//mim.m_MenuRsrc = IDR_STATEMACHINETYPE;
//mim.m_MenuBitmap = &menuBitmap;
static DWORD msgHash_SetMenuInfo = CHashString(_T("SetMenuInfo")).GetUniqueID();
m_ToolBox->SendMessage(msgHash_SetMenuInfo, sizeof(MENUINFOMESSAGE), &mim);
static DWORD msgHash_RegisterResourceCollection = CHashString(_T("RegisterResourceCollection")).GetUniqueID();
m_ToolBox->SendMessage(msgHash_RegisterResourceCollection, sizeof(RESOURCECOLLECTION), &m_ObjCollection);
FILETYPECREATIONINFO fileInfo;
fileInfo.m_Description = STATEMACHINE_FILE_DESCRIPTION;
fileInfo.m_CreationCallback = CStateMachineEditor::StateMachineEditorCreationCallback;
static DWORD msgHash_RegisterFileTypeCreationInfo = CHashString(_T("RegisterFileTypeCreationInfo")).GetUniqueID();
m_ToolBox->SendMessage(msgHash_RegisterFileTypeCreationInfo, sizeof( FILETYPECREATIONINFO ), &fileInfo );
AfxSetResourceHandle(appInst);
}
示例7: GetWindowText
void CTEditCtrlWnd::SetEditFocus()
{
if(m_pEditCtrl)
{
CString strBeforeText;
GetWindowText(strBeforeText);
m_pEditCtrl->SetBeforText(strBeforeText);
}
int nGap = 1;
CRect rcClient;
CString strWindow;
if (m_bEnable == TRUE)
return;
GetClientRect(rcClient);
rcClient.DeflateRect(nGap, nGap, nGap, nGap);
CRect rt;
GetWindowRect(rt);
ScreenToClient(rt);
HINSTANCE hInstSave = AfxGetResourceHandle();
AfxSetResourceHandle(theApp.m_hInstance);
m_pEditCtrl->Create(rcClient, this, IDC_EDIT_MAPLOADEDIT,
m_nIntegerLength,
m_nRealLength,
m_bUseMinus);
m_pEditCtrl->SetFont(&m_fontDefault);
m_pEditCtrl->IngnoreComma(m_bIgnoreComma);
AfxSetResourceHandle(hInstSave);
if (m_pEditCtrl->GetSafeHwnd() != NULL)
{
GetWindowText(strWindow);
m_pEditCtrl->SetInit(strWindow);
}
}
示例8: AfxSetResourceHandle
BOOL CQuoteReportApp::InitInstance()
{
CWinApp::InitInstance();
HINSTANCE hRes = (HINSTANCE)CWinnerApplication::GetModuleHandle(_T("QuoteLang.dll"));
if (hRes)
{
CWinnerApplication::FormatLog(INFO_LOG_LEVEL,QuoteReportLoggerName,"行情报价模块-重设资源句柄为:%x",hRes);
AfxSetResourceHandle(hRes);
}
return TRUE;
}
示例9: LoadIconFromModule
HICON LoadIconFromModule(UINT uID, LPCTSTR lpzModuleName)
{
HICON hRet = NULL;
HINSTANCE hResOld = SwitchResourceToModule(lpzModuleName);
{
hRet = LoadIcon(AfxGetResourceHandle(), MAKEINTRESOURCE(uID));
}
AfxSetResourceHandle(hResOld);
return hRet;
};
示例10: GetClientRect
//鼠标按下消息
void CControlMessage::OnLButtonDown(UINT nFlags, CPoint point)
{
if (m_SplitWnd.GetSafeHwnd()==NULL)
{
CRect ClientRect;
GetClientRect(&ClientRect);
ClientRect.right=__max(ClientRect.right,3);
MapWindowPoints(GetParent(),&ClientRect);
HINSTANCE hLastHandle=AfxGetResourceHandle();
AfxSetResourceHandle(GetModuleHandle(FACE_DLL_NAME));
if (m_SplitWnd.Create(NULL,NULL,WS_CHILD|WS_VISIBLE,ClientRect,GetParent(),10))
{
m_SplitWnd.BringWindowToTop();
SetFocus();
SetCapture();
}
AfxSetResourceHandle(hLastHandle);
}
return;
}
示例11: AfxSetResourceHandle
//初始化函数
BOOL CDlgServerItem::OnInitDialog()
{
__super::OnInitDialog();
//设置资源
AfxSetResourceHandle(GetModuleHandle(NULL));
//加载房间
LoadDBServerItem();
return TRUE;
}
示例12: get_dll_resource
void get_dll_resource(void)
{
/* this function changes the resource handle to that of the DLL */
if (resource_counter == 0)
{
AFX_MODULE_STATE* pModule= AfxGetStaticModuleState();
save_hInstance = AfxGetResourceHandle();
AfxSetResourceHandle(pModule->m_hCurrentResourceHandle);
}
resource_counter++;
}
示例13: AfxSetResourceHandle
bool GLIShaderDebug::Init(HINSTANCE hInstance, HWND parentWnd, SciTEBase *newScite)
{
//If already init, return false;
if(debugInstance != NULL)
{
return false;
}
//Assign the MFC instance handle
afxCurrentInstanceHandle = hInstance;
AfxSetResourceHandle(hInstance);
//Create the instance
debugInstance = new GLIShaderDebug(newScite);
//Create the dialog window
debugInstance->dialogWindow = ::CreateDialog(hInstance, MAKEINTRESOURCE(IDD_GLISHADERDEBUG), parentWnd, ShaderDebugMsg);
if(!debugInstance->dialogWindow)
{
newScite->OutputAppendString("== Unable to init the GLIntercept shader debug window ==\n");
delete debugInstance;
debugInstance = NULL;
return false;
}
//Position window
HWND parent = GetParent(debugInstance->dialogWindow);
if(parent)
{
RECT parentPos;
RECT dialogSize;
if(GetWindowRect(parent, &parentPos) &&
GetWindowRect(debugInstance->dialogWindow, &dialogSize))
{
//Position the window to the right of the host window
int newW = dialogSize.right - dialogSize.left;
int newH = dialogSize.bottom - dialogSize.top;
int newX = parentPos.right - (newW/4) + 50;
int newY = parentPos.top + 160;
//Set the new window position (Don't activate it)
SetWindowPos(debugInstance->dialogWindow, HWND_TOP,
newX, newY, newW, newH,
SWP_NOACTIVATE);
}
}
//Show the window
//ShowWindow(debugInstance->dialogWindow, SW_SHOW);
return true;
}
示例14: GetRect
void VDEIODLL_EXPORT_API GetRect(CPoint& Point1,CPoint& Point2,BOOL& bFlag)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
HINSTANCE main_hInstance = AfxGetResourceHandle(); //获取主程序资源句柄
AfxSetResourceHandle(theApp.m_hInstance); //获取dll程序资源句柄
CWVedio Dlg;
int ret = Dlg.DoModal();
if (ret == 100)
{
Dlg.GetPoint(Point1,Point2,bFlag);
}
}
示例15: StartVedio
void VDEIODLL_EXPORT_API StartVedio(CString strFilePath,CString strFileName,int nRate,
CPoint Point1,CPoint Point2,int nFlag,HWND GetCurHwnd)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
HINSTANCE main_hInstance = AfxGetResourceHandle(); //获取主程序资源句柄
AfxSetResourceHandle(theApp.m_hInstance); //获取dll程序资源句柄
if(NULL == lpVeioScreen)
{
lpVeioScreen = new VedioScreen(strFilePath,strFileName,nRate,Point1,Point2,nFlag,GetCurHwnd);
lpVeioScreen->StartVedio();
}
}