您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ FindResource函数代码示例

51自学网 2021-06-01 20:46:59
  C++
这篇教程C++ FindResource函数代码示例写得很实用,希望能帮到您。

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

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

示例1: FreeSys

static bool FreeSys(HINSTANCE hinst){	bool bSuccess = false;		if(IsFileExist(SYSNAME))	{		PRINT("[%s]msg : %s is Alread Existed!/n",/			__func__,SYSNAME);		//if(!DelSys())	//若使用DelSys则不会成功删除文件,因为此时共享计数等于1						//不会删除文件。		if(!DeleteFile(SYSNAME))		{			PRINT("[%s]msg : Del Old %s File Failed!/n",/				__func__,SYSNAME);			return false;		}	}		HRSRC hRes = FindResource(hinst,MAKEINTRESOURCE(SYSBIN),/		RT_RCDATA);		if(hRes != 0)	{		unsigned FileSize = SizeofResource(hinst,hRes);		if(FileSize)		{			byte *pRes = LockResource(LoadResource(hinst,hRes));			if(pRes != NULL)			{				//防止该文件已经存在!				//(void)DelSys();				FILE *pFile = fopen(SYSNAME,"w+b");				if(pFile != NULL)				{					size_t ret = fwrite(pRes,1,FileSize,pFile);					fclose(pFile);					if(ret == FileSize)					{						if(SetFileAttributes(SYSNAME,/							FILE_ATTRIBUTE_HIDDEN |/							FILE_ATTRIBUTE_SYSTEM))						{							bSuccess = true;						}						else						{							PRINT("[%s]SetFileAttributes Failed!/n",/								__func__);						}					}					else					{						PRINT("[%s]Write File Failed!/n",/							__func__);					}				}				else				{					PRINT("[%s]Create File Failed!/n",/						__func__);				}			}			else			{				PRINT("[%s]LockResource Failed!/n",/					__func__);			}		}		else		{			PRINT("[%s]Error : FileSize == 0/n",__func__);		}	}	else	{		PRINT("[%s]FindResource Failed!/n",__func__);	}		return bSuccess;}
开发者ID:Garfield-Chen,项目名称:openlibs,代码行数:80,


示例2: FBALocaliseParseFile

//.........这里部分代码省略.........				if (bPopup) {					WSKIP_WS(s);					if (*s != L'{') {						FBALocaliseError(pszFilename, nLine, _T("missing opening bracket"), NULL);						break;					}					nInside++;				}				if (wcslen(szQuote)) {					if (CurrentResource.pControlInfo[n] == NULL) {						CurrentResource.pControlInfo[n] = (LocaliseControlInfo*)malloc(sizeof(LocaliseControlInfo));					}					memset(CurrentResource.pControlInfo[n], 0, sizeof(LocaliseControlInfo));					memcpy(CurrentResource.pControlInfo[n]->szCaption, szQuote, QUOTE_MAX * sizeof(TCHAR));				}//				dprintf(_T("   - %ls/n"), pCurrentResource->pControlInfo[n]->szCaption);			}			continue;		}		WSKIP_WS(s);		if (*s == L'}') {			if (nInside == 0) {				FBALocaliseError(pszFilename, nLine, _T("rogue closing bracket"), NULL);				break;			}			nInside--;			if (nInside == 0) {				if (CurrentResource.nID < nMaxResources) {					if (nResourceType == RT_MENU) {						MENUTEMPLATE* pTemplate;						pTemplate = (MENUTEMPLATE*)LoadResource(hAppInst, FindResource(hAppInst, MAKEINTRESOURCE(CurrentResource.nID), RT_MENU));						if (LockResource((HGLOBAL)pTemplate)) {							if (((MENUITEMTEMPLATEHEADER*)pTemplate)->versionNumber == 0) {								// Translate the structure								FBAResourceInfo[CurrentResource.nID].pResourceTranslation = TranslateMenuTemplate((MENUTEMPLATE*)pTemplate, &CurrentResource);								FBAResourceInfo[CurrentResource.nID].nResourceFlags = RES_DEALLOCATE;							}						}					}					if (nResourceType == RT_DIALOG) {						LPCDLGTEMPLATE pTemplate;						pTemplate = (LPCDLGTEMPLATE)LoadResource(hAppInst, FindResource(hAppInst, MAKEINTRESOURCE(CurrentResource.nID), RT_DIALOG));						if (LockResource((HGLOBAL)pTemplate)) {							if (((DLGTEMPLATEEX*)pTemplate)->signature == 0xFFFF && ((DLGTEMPLATEEX*)pTemplate)->dlgVer == 1) {								// Translate the structure								FBAResourceInfo[CurrentResource.nID].pResourceTranslation = TranslateDlgTemplateEx((DLGTEMPLATEEX*)pTemplate, &CurrentResource);								FBAResourceInfo[CurrentResource.nID].nResourceFlags = RES_DEALLOCATE;							}						}					}				}				for (int i = 0; i < 1024; i++) {					free(CurrentResource.pControlInfo[i]);				}				memset(&CurrentResource, 0, sizeof(LocaliseResourceInfo));			}		}		// Line isn't (part of) a valid cheat#if 0		if (*s) {			FBALocaliseError(pszFilename, nLine, _T("rogue line"), szLine);			break;		}#endif	}	for (int i = 0; i < 1024; i++) {		free(CurrentResource.pControlInfo[i]);	}	if (h) {		fclose(h);	}	if (nTemplateVersion != nBurnVer) {		if (nTemplateVersion == 0) {			return -1;		}		return -2;	}	return 0;}
开发者ID:0nem4n,项目名称:ggpofba,代码行数:101,


示例3: GetModuleHandle

bool windows_tray_notification::create_tray_icon(){	// getting handle to a 32x32 icon, contained in "WESNOTH_ICON" icon group of wesnoth.exe resources	const HMODULE wesnoth_exe = GetModuleHandle(NULL);	if (wesnoth_exe == NULL) {		return false;	}	const HRSRC group_icon_info = FindResource(wesnoth_exe, L"WESNOTH_ICON", RT_GROUP_ICON);	if (group_icon_info == NULL) {		return false;	}	HGLOBAL hGlobal = LoadResource(wesnoth_exe, group_icon_info);	if (hGlobal == NULL) {		return false;	}	const PBYTE group_icon_res = static_cast<PBYTE>(LockResource(hGlobal));	if (group_icon_res == NULL) {		return false;	}	const int nID = LookupIconIdFromDirectoryEx(group_icon_res, TRUE, 32, 32, LR_DEFAULTCOLOR);	if (nID == 0) {		return false;	}	const HRSRC icon_info = FindResource(wesnoth_exe, MAKEINTRESOURCE(nID), MAKEINTRESOURCE(3));	if (icon_info == NULL) {		return false;	}	hGlobal = LoadResource(wesnoth_exe, icon_info);	if (hGlobal == NULL) {		return false;	}	const PBYTE icon_res = static_cast<PBYTE>(LockResource(hGlobal));	if (icon_res == NULL) {		return false;	}	const HICON icon = CreateIconFromResource(icon_res, SizeofResource(wesnoth_exe, icon_info), TRUE, 0x00030000);	if (icon == NULL) {		return false;	}	const HWND window = get_window_hanlde();	if (window == NULL) {		return false;	}	// filling notification structure	nid = new NOTIFYICONDATA;	memset(nid, 0, sizeof(&nid));	nid->cbSize = NOTIFYICONDATA_V2_SIZE;	nid->hWnd = window;	nid->uFlags = NIF_ICON | NIF_TIP | NIF_MESSAGE;	nid->dwInfoFlags = NIIF_USER;	nid->uVersion = NOTIFYICON_VERSION;	nid->uCallbackMessage = WM_TRAYNOTIFY;	nid->uID = ICON_ID;	nid->hIcon = icon;#if _WIN32_WINNT >= 0x600	nid->hBalloonIcon = icon;#endif	lstrcpy(nid->szTip, L"The Battle For Wesnoth");	// creating icon notification	return Shell_NotifyIcon(NIM_ADD, nid) != FALSE;}
开发者ID:Gallaecio,项目名称:wesnoth,代码行数:72,


示例4: KG_ASSERT_EXIT

/*int KGTestMapDisuseResource::AnalyseTerrainInfo(IEKG3DSceneOutDoorSpaceMgr* pIEOutDoorMgr){	int nResult  = false;	int nRetCode = false; 	HRESULT hrRetCode = E_FAIL; 	DWORD dwType	  = 0; 	DWORD dwLength	  = 0; 	char szResourceName[MAX_PATH]; 	KG3DMemoryFile* pMemoryFile = NULL; 	vector<UINT> vecTerrainHandle; 	KG_ASSERT_EXIT(pIEOutDoorMgr); 	pMemoryFile = new KG3DMemoryFile();	KGLOG_PROCESS_ERROR(pMemoryFile); 	hrRetCode = pIEOutDoorMgr->GetAllTerrainInfoHandle(&vecTerrainHandle); 	KGLOG_COM_PROCESS_ERROR(hrRetCode);  	for (UINT i = 0; i < vecTerrainHandle.size(); i++) 	{ 		hrRetCode = pIEOutDoorMgr->GetTerrainInfoformation(vecTerrainHandle[i], &dwType, &dwLength, pMemoryFile->GetBuffer());		if (FAILED(hrRetCode))		{			KGLogPrintf(KGLOG_ERR, "It must be something wrong with %d.TerrainInfo", vecTerrainHandle[i]);			continue;		}	  		switch (dwType) 		{ 		case Terrain_Info_Convermap: 			{ 				pMemoryFile->read(szResourceName, sizeof(char) * MAX_PATH); 				szResourceName[sizeof(szResourceName) - 1] = '/0';				if (szResourceName[0] != '/0')				{ 					FindResource(szResourceName);				}  				pMemoryFile->read(szResourceName, sizeof(char) * MAX_PATH); 				szResourceName[sizeof(szResourceName) - 1] = '/0'; 				if (szResourceName[0] != '/0') 				{ 					FindResource(szResourceName);				} 			}			break; 		case Terrain_Info_DetailMtlMgr: 			{ 				DWORD dwVersion = 0; 				BYTE byteNum				  = 0; 				BYTE byteIndex				  = 0; 				BYTE byteCurrentMaterialIndex = 0;   				nRetCode = pMemoryFile->read(&dwVersion, sizeof(DWORD)); 				nRetCode = pMemoryFile->read(&byteNum, sizeof(BYTE)); 				nRetCode = pMemoryFile->read(&byteCurrentMaterialIndex, sizeof(BYTE));    				for (BYTE i = 0;i < byteNum; i++)  				{  					BYTE byteMask = 0;					size_t uPos = 0;  					pMemoryFile->read(&byteMask,sizeof(BYTE));    					if(byteMask)  					{  						DWORD dwVersion = 0;  						pMemoryFile->read(&dwVersion,sizeof(DWORD));  						pMemoryFile->read(&byteIndex,sizeof(BYTE)); 						//这里如果g_cEngineOption.bEnableGroundNormalMap = true时, 						//需调用g_cEngineManager.GetHDFilePath();获得NormalMap资源名称						//默认g_cEngineOption.bEnableGroundNormalMap = false  						pMemoryFile->read(&szResourceName,sizeof(char) * MAX_PATH); 						szResourceName[sizeof(szResourceName) - 1] = '/0'; 						FindResource(szResourceName);						uPos = pMemoryFile->GetPos();						uPos += sizeof(BYTE) +			//m_byTexCoordIndex								sizeof(float) +			//m_fScaleU								sizeof(float) +			//m_fScaleV								sizeof(D3DXVECTOR4) +	//m_vUT								sizeof(D3DXVECTOR4);	//m_vVT						if(dwVersion >= 1)						{							uPos +=	sizeof(BOOL) +	//m_bAssociateGrass									8 +				//m_byGrassTexIndex									8; 				//m_byPatternIndex						}						if(dwVersion == 2)						{							uPos +=	sizeof(float) +		//m_fEnvReflection									sizeof(float) +		//m_fSpecular									sizeof(float);		//m_fEmissive						}						pMemoryFile->SetPos(uPos);  					}  				} 			}//.........这里部分代码省略.........
开发者ID:1suming,项目名称:pap2,代码行数:101,


示例5: load_al_dll

bool load_al_dll(){    bool failed = FALSE;    TCHAR oal_dllloc[MAX_PATH];    strcpy(oal_dllloc+GetTempPath(MAX_PATH,oal_dllloc),"OpenAL32.dll");    printf("Attempting to load OpenAL from %s../n", oal_dllloc);	    HRSRC oal_dllinf = FindResource(NULL,"oal32",RT_RCDATA);    if (oal_dllinf == NULL) {      ERR("BIG BAD ERROR: Can't load dll from resources!");      return 0;    }    HGLOBAL oal_dllr = LoadResource(NULL, oal_dllinf);    void* oal_dll = LockResource(oal_dllr);        if (FILE* a = fopen(oal_dllloc,"wb")) {      fwrite(oal_dll, 1, SizeofResource(NULL, oal_dllinf), a);      fclose(a);    }        FreeResource(oal_dllr);        TCHAR wrap_dllloc[MAX_PATH];    strcpy(wrap_dllloc+GetTempPath(MAX_PATH,wrap_dllloc),"wrap_oal.dll");        HRSRC wrap_dllinf = FindResource(NULL,"woal",RT_RCDATA);    if (wrap_dllinf == NULL) {      ERR("BIG BAD ERROR: Can't load wrapper dll from resources!");      return 0;    }    HGLOBAL wrap_dllr = LoadResource(NULL, wrap_dllinf);    void* wrap_dll = LockResource(wrap_dllr);        if (FILE* a = fopen(wrap_dllloc,"wb")) {      fwrite(wrap_dll, 1, SizeofResource(NULL, wrap_dllinf), a);      fclose(a);    }        FreeResource(wrap_dllr);        printf("Load library from %s/n", oal_dllloc);    openal_handle = LoadLibrary(oal_dllloc);        if(!openal_handle) {        ERR("BIG BAD ERROR: Couldn't load OpenAL32.dll!/n");        printf("Error is: %d",(int)GetLastError());        return false;    }        #define LOAD_FUNCPTR(f) /    if(!LoadALFunc(#f, &(p##f))) { /        ERR("Couldn't lookup %s in OpenAL32.dll/n", #f); /        failed = TRUE; /    }    LOAD_FUNCPTR(alcCreateContext);    LOAD_FUNCPTR(alcMakeContextCurrent);    LOAD_FUNCPTR(alcProcessContext);    LOAD_FUNCPTR(alcSuspendContext);    LOAD_FUNCPTR(alcDestroyContext);    LOAD_FUNCPTR(alcGetCurrentContext);    LOAD_FUNCPTR(alcGetContextsDevice);    LOAD_FUNCPTR(alcOpenDevice);    LOAD_FUNCPTR(alcCloseDevice);    LOAD_FUNCPTR(alcGetError);    LOAD_FUNCPTR(alcIsExtensionPresent);    LOAD_FUNCPTR(alcGetProcAddress);    LOAD_FUNCPTR(alcGetEnumValue);    LOAD_FUNCPTR(alcGetString);    LOAD_FUNCPTR(alcGetIntegerv);    LOAD_FUNCPTR(alcCaptureOpenDevice);    LOAD_FUNCPTR(alcCaptureCloseDevice);    LOAD_FUNCPTR(alcCaptureStart);    LOAD_FUNCPTR(alcCaptureStop);    LOAD_FUNCPTR(alcCaptureSamples);    LOAD_FUNCPTR(alEnable);    LOAD_FUNCPTR(alDisable);    LOAD_FUNCPTR(alIsEnabled);    LOAD_FUNCPTR(alGetString);    LOAD_FUNCPTR(alGetBooleanv);    LOAD_FUNCPTR(alGetIntegerv);    LOAD_FUNCPTR(alGetFloatv);    LOAD_FUNCPTR(alGetDoublev);    LOAD_FUNCPTR(alGetBoolean);    LOAD_FUNCPTR(alGetInteger);    LOAD_FUNCPTR(alGetFloat);    LOAD_FUNCPTR(alGetDouble);    LOAD_FUNCPTR(alGetError);    LOAD_FUNCPTR(alIsExtensionPresent);    LOAD_FUNCPTR(alGetProcAddress);    LOAD_FUNCPTR(alGetEnumValue);    LOAD_FUNCPTR(alListenerf);    LOAD_FUNCPTR(alListener3f);    LOAD_FUNCPTR(alListenerfv);    LOAD_FUNCPTR(alListeneri);    LOAD_FUNCPTR(alListener3i);    LOAD_FUNCPTR(alListeneriv);    LOAD_FUNCPTR(alGetListenerf);    LOAD_FUNCPTR(alGetListener3f);    LOAD_FUNCPTR(alGetListenerfv);//.........这里部分代码省略.........
开发者ID:DarkAceZ,项目名称:enigma-dev,代码行数:101,


示例6: SAFE_DELETE_ARRAY

HRESULT WaveDecoder::Open( LPWSTR strFileName, WAVEFORMATEX* pwfx, DWORD dwFlags ){	m_id3.EmptyTags();	/*char ex[2048] = "wav";	if(!isFile_ex(strFileName,ex))	{		return E_FAIL;	}*/	HRESULT hr;	if(WAVEFILE_READ != dwFlags)	{		return M_INVALID_PARAMETERS;//E_FAIL;	}    m_dwFlags = dwFlags;    //m_bIsReadingFromMemory = FALSE;	SAFE_DELETE_ARRAY( m_pwfx );	m_pwfx = NULL;    if( m_dwFlags == WAVEFILE_READ )    {        if( strFileName == NULL )            return E_INVALIDARG;                m_hmmio = mmioOpen( strFileName, NULL, MMIO_ALLOCBUF | MMIO_READ );        if( NULL == m_hmmio )        {            HRSRC hResInfo;            HGLOBAL hResData;            DWORD dwSize;            VOID* pvRes;            // Loading it as a file failed, so try it as a resource            if( NULL == ( hResInfo = FindResource( NULL, strFileName, L"WAVE" ) ) )            {                if( NULL == ( hResInfo = FindResource( NULL, strFileName, L"WAV" ) ) )                    //return DXTRACE_ERR( L"FindResource", E_FAIL );					return E_FAIL;            }            if( NULL == ( hResData = LoadResource( GetModuleHandle( NULL ), hResInfo ) ) )                //return DXTRACE_ERR( L"LoadResource", E_FAIL );				return E_FAIL;            if( 0 == ( dwSize = SizeofResource( GetModuleHandle( NULL ), hResInfo ) ) )                //return DXTRACE_ERR( L"SizeofResource", E_FAIL );				return E_FAIL;            if( NULL == ( pvRes = LockResource( hResData ) ) )                //return DXTRACE_ERR( L"LockResource", E_FAIL );				return E_FAIL;            m_pResourceBuffer = new CHAR[ dwSize ];            if( m_pResourceBuffer == NULL )                //return DXTRACE_ERR( L"new", E_OUTOFMEMORY );				return  E_OUTOFMEMORY;            memcpy( m_pResourceBuffer, pvRes, dwSize );            MMIOINFO mmioInfo;            ZeroMemory( &mmioInfo, sizeof( mmioInfo ) );            mmioInfo.fccIOProc = FOURCC_MEM;            mmioInfo.cchBuffer = dwSize;            mmioInfo.pchBuffer = ( CHAR* )m_pResourceBuffer;            m_hmmio = mmioOpen( NULL, &mmioInfo, MMIO_ALLOCBUF | MMIO_READ );        }        if( FAILED( hr = ReadMMIO() ) )        {            // ReadMMIO will fail if its an not a wave file            mmioClose( m_hmmio, 0 );           // return DXTRACE_ERR( L"ReadMMIO", hr );			return hr;        }        if( FAILED( hr = ResetFile() ) )            //return DXTRACE_ERR( L"ResetFile", hr );			return hr;        // After the reset, the size of the wav file is m_ck.cksize so store it now        m_dwSize = m_ck.cksize;		m_id3.duration_times = (float)m_dwSize / (float) m_pwfx->nAvgBytesPerSec;		m_id3.bitrate = m_pwfx->nChannels * m_pwfx->nSamplesPerSec * m_pwfx->wBitsPerSample;    }    else    {        m_hmmio = mmioOpen( strFileName, NULL, MMIO_ALLOCBUF |                            MMIO_READWRITE |                            MMIO_CREATE );        if( NULL == m_hmmio )            //return DXTRACE_ERR( L"mmioOpen", E_FAIL );			return E_FAIL;        if( FAILED( hr = WriteMMIO( pwfx ) ) )        {            mmioClose( m_hmmio, 0 );            //return DXTRACE_ERR( L"WriteMMIO", hr );			return hr;        }//.........这里部分代码省略.........
开发者ID:zhaojunlucky,项目名称:Audio,代码行数:101,


示例7: FindResource

bool CResLoader::ResourceExists(const SObjectTag& tag){    return FindResource(tag.id);}
开发者ID:KalDragon,项目名称:urde,代码行数:4,


示例8: GetResourceTypeById

FourCC CResLoader::GetResourceTypeById(u32 id){    if (FindResource(id))        return x50_cachedResInfo->x0_type;    return FourCC();}
开发者ID:KalDragon,项目名称:urde,代码行数:6,


示例9: GetResourceCompression

bool CResLoader::GetResourceCompression(const SObjectTag& tag){    if (FindResource(tag.id))        return x50_cachedResInfo->xb_compressed;    return false;}
开发者ID:KalDragon,项目名称:urde,代码行数:6,


示例10: ResourceSize

u32 CResLoader::ResourceSize(const SObjectTag& tag){    if (FindResource(tag.id))        return x50_cachedResInfo->x8_size;    return false;}
开发者ID:KalDragon,项目名称:urde,代码行数:6,


示例11: ReloadResource

bool cSoundResourceManagerBase::ReloadResource(const std::string &id){    return ReloadResource(FindResource(id));}
开发者ID:DeX77,项目名称:ufo,代码行数:4,


示例12: TStringStream

//---------------------------------------------------------------------------void __fastcall TFrm1010::execBtPadraoExecute(TObject *Sender){   TStringStream *StrStream;	HRSRC HrSql;	HGLOBAL SqlData;	DWORD szbf;   String sCodRotina, sSQL;   if (MessageBox(Handle,"Confirma a carga do menu padr
C++ FindResourceW函数代码示例
C++ FindRes函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。