BOOL CBCGPBaseInfoLoader::Load (LPCTSTR lpszResID, LPCTSTR lpszResType, HINSTANCE hInstance/* = NULL*/) { if (lpszResID == NULL) { ASSERT (FALSE); return FALSE; } if (lpszResType == NULL) { lpszResType = m_lpszResType; } if (lpszResType == NULL) { ASSERT (FALSE); return FALSE; } BOOL bRes = FALSE; if (hInstance == NULL) { hInstance = AfxFindResourceHandle(lpszResID, lpszResType); } if (hInstance == NULL) { ASSERT (FALSE); return FALSE; } m_hInstance = hInstance; HRSRC hRsrc = ::FindResource(m_hInstance, lpszResID, lpszResType); if (hRsrc == NULL) { return FALSE; } DWORD nLength = ::SizeofResource(m_hInstance, hRsrc); if (nLength == 0) { return FALSE; } HGLOBAL hGlobal = ::LoadResource(m_hInstance, hRsrc); if (hGlobal == NULL) { return FALSE; } LPTSTR lpszXML = NULL; CBCGPTagManager::UTF8ToString ((LPCSTR)::LockResource (hGlobal), lpszXML, nLength); ::UnlockResource (hGlobal); ::FreeResource (hGlobal); if (lpszXML != NULL) { bRes = LoadFromBuffer (lpszXML); delete [] lpszXML; } return bRes; }