Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cAppRes.h
Go to the documentation of this file.
1 //
4 //
5 
6 #ifndef _INC_cAppRes_H
7 #define _INC_cAppRes_H
8 #ifndef NO_PRAGMA_ONCE
9 #pragma once
10 #endif
11 
12 #include "../WinAPI/cWinResource.h"
15 
16 namespace GrayLib
17 {
18 #if defined(_WIN32) && ! defined(_MFC_VER)
19  inline HINSTANCE AfxGetResourceHandle()
20  {
22  return cAppState::get_HModule();
23  }
24 #endif
25 
27  : public cSingleton<cAppRes> // May be static or dynamic.
28  , public cWinResMod
29  {
35 
36  typedef cWinResMod SUPER_t;
38 
39  public:
40  cAppRes();
41  virtual ~cAppRes();
42 
44  static cString GRAYCALL LoadStrID(RESOURCEID_t idString);
45  static cString GRAYCALL LoadStr(const GChar_t* pszString);
46 
47 #ifdef _MFC_VER
48  HICON LoadIconX(const GChar_t* pszResourceName) const
49  {
50  // MFC CWinApp::LoadIcon RT_ICON or RT_GROUP_ICON
51  cWinResMod res(pszResourceName, ATL_RT_GROUP_ICON);
52  return res.LoadIconX(pszResourceName);
53  }
54  HICON LoadIconID(RESOURCEID_t id) const
55  {
56  // MFC CWinApp::LoadIcon RT_ICON or RT_GROUP_ICON
57  return LoadIconX(ATL_MAKEINTRESOURCE(id));
58  }
59  HCURSOR LoadCursorX(const GChar_t* pszResourceName) const
60  {
61  // RT_CURSOR or RT_GROUP_CURSOR
62  cWinResMod res(pszResourceName, ATL_RT_GROUP_CURSOR);
63  return res.LoadCursorX(pszResourceName);
64  }
65  HCURSOR LoadCursorID(RESOURCEID_t id) const
66  {
67  // RT_CURSOR or RT_GROUP_CURSOR
68  return LoadCursorX(ATL_MAKEINTRESOURCE(id));
69  }
70 #endif
71 
72  };
73 }
74 
75 #endif
#define GRAYCALL
declare calling convention for static functions so everyone knows the arg passing scheme....
Definition: GrayCore.h:36
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
#define CHEAPOBJECT_IMPL
Definition: cHeapObject.h:32
Definition: cAppRes.h:29
Definition: cWinResource.h:19
static HMODULE __stdcall get_HModule()
Definition: cAppState.cpp:782
Definition: cSingleton.h:127
Definition: cMesh.h:22
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