本文整理匯總了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();
}
}