6 #ifndef _INC_cWinResource_H
7 #define _INC_cWinResource_H
38 : m_hModule(::AfxFindResourceHandle(pszResourceName, pResourceType))
49 return (
const GChar_t*)((UINT_PTR)((WORD)(id)));
54 return ((((ULONG_PTR)(pszText)) >> 16) == 0);
59 return (((UINT_PTR)(pszText)) & 0x0FFFF);
65 HICON LoadIconX(
const GChar_t* pszResourceName)
const noexcept
71 return _GTN(::LoadIcon)(m_hModule, pszResourceName);
78 return LoadIconX(THIS_t::MakeIntResource(
id));
80 HCURSOR LoadCursorX(
const GChar_t* pszResourceName)
const noexcept
84 return _GTN(::LoadCursor)(m_hModule, pszResourceName);
89 return LoadCursorX(THIS_t::MakeIntResource(
id));
96 return _GTN(::LoadBitmap)(m_hModule, THIS_t::MakeIntResource(
id));
102 return _GTN(::LoadMenu)(m_hModule, THIS_t::MakeIntResource(
id));
104 HACCEL LoadAcceleratorsID(
RESOURCEID_t id)
const noexcept
107 return _GTN(::LoadAccelerators)(m_hModule, THIS_t::MakeIntResource(
id));
115 class cWinResource :
public cWinResMod
128 : cWinResMod(hModule)
136 ~cWinResource() noexcept
140 bool FindRes(
const GChar_t* pszResourceName,
const void* pResType = RT_STRING) noexcept
146 if (pszResourceName ==
nullptr)
148 m_hFind =
_GTN(::FindResource)(m_hModule, pszResourceName, (
const GChar_t*)pResType);
154 bool LoadLock() noexcept
157 m_hData = ::LoadResource(m_hModule, m_hFind);
160 m_pData = ::LockResource(m_hData);
161 if (m_pData ==
nullptr)
165 bool FindLoadLock(
const GChar_t* pszResourceName,
const void* pResType = RT_RCDATA) noexcept
170 if (!FindRes(pszResourceName, pResType))
174 size_t SizeofResource() const noexcept
177 return ::SizeofResource(m_hModule, m_hFind);
179 void Close() noexcept
183 if (m_pData !=
nullptr)
186 UnlockResource(m_hData);
191 ::FreeResource(m_hData);
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
#define _GTN(c)
_WIN32 name has a A or W for UTF8 or UNICODE (like _FNF)
Definition: StrConst.h:28
#define HANDLE_NULL
Invalid OS handle for _WIN32. Not invalid OS handle for linux.
Definition: cOSHandle.h:21
#define HMODULE_NULL
Definition: cOSModule.h:31
Definition: cWinResource.h:19
HMODULE m_hModule
Definition: cWinResource.h:27
static constexpr RESOURCEID_t GetIntResource(const GChar_t *pszText) noexcept
Definition: cWinResource.h:56
cWinResMod(HMODULE hModule) noexcept
Definition: cWinResource.h:30
static constexpr bool IsIntResource(const GChar_t *pszText) noexcept
Definition: cWinResource.h:51
static constexpr const GChar_t * MakeIntResource(RESOURCEID_t id) noexcept
Definition: cWinResource.h:45
WORD RESOURCEID_t
A resource in .RC attached to a file/module. like MAKEINTRESOURCE(). https://docs....
Definition: cResourceBase.h:19
char GChar_t
My version of TCHAR, _TCHAR.
Definition: StrConst.h:26