Changeset 797 in dev for branches/egtra/ab5.0/abdev/abdev-impl/Resource/Load.cpp
- Timestamp:
- Feb 1, 2011, 11:13:15 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/egtra/ab5.0/abdev/abdev-impl/Resource/Load.cpp
r795 r797 35 35 } 36 36 37 void* GetResource(HINSTANCE hinst, USHORT id, LPCTSTR type) 37 HICON LoadIconCursorImpl(HINSTANCE hinst, USHORT id, int cxDesired, int cyDesired, UINT load, bool isIcon) 38 { 39 auto pResource = LoadResourceAlt(hinst, id, isIcon ? RT_GROUP_ICON : RT_GROUP_CURSOR); 40 41 auto idIcon = LookupIconIdFromDirectoryEx(reinterpret_cast<PBYTE>(pResource), isIcon, cxDesired, cyDesired, load); 42 auto icon = LoadResourceAltWithSize(hinst, numeric_cast<USHORT>(idIcon), isIcon ? RT_ICON : RT_CURSOR); 43 44 return CreateIconFromResourceEx(reinterpret_cast<PBYTE>(icon.first), 45 icon.second, isIcon, 0x00030000, cxDesired, cyDesired, load); 46 } 47 48 } // unnamed namespace 49 50 void* LoadResourceAlt(HINSTANCE hinst, USHORT id, LPCTSTR type) 38 51 { 39 52 if (auto hrsrc = ::FindResource(hinst, MAKEINTRESOURCE(id), type)) … … 47 60 } 48 61 49 std::pair<void*, DWORD> GetResourceWithSize(HINSTANCE hinst, USHORT id, LPCTSTR type)62 std::pair<void*, DWORD> LoadResourceAltWithSize(HINSTANCE hinst, USHORT id, LPCTSTR type) 50 63 { 51 64 typedef std::pair<void*, DWORD> result_type; … … 64 77 return result_type(nullptr, 0); 65 78 } 66 67 HICON LoadIconCursorImpl(HINSTANCE hinst, USHORT id, int cxDesired, int cyDesired, UINT load, bool isIcon)68 {69 auto pResource = GetResource(hinst, id, isIcon ? RT_GROUP_ICON : RT_GROUP_CURSOR);70 71 auto idIcon = LookupIconIdFromDirectoryEx(reinterpret_cast<PBYTE>(pResource), isIcon, cxDesired, cyDesired, load);72 auto icon = GetResourceWithSize(hinst, numeric_cast<USHORT>(idIcon), isIcon ? RT_ICON : RT_CURSOR);73 74 return CreateIconFromResourceEx(reinterpret_cast<PBYTE>(icon.first),75 icon.second, isIcon, 0x00030000, cxDesired, cyDesired, load);76 }77 78 } // unnamed namespace79 79 80 80 HICON LoadIconAlt(HINSTANCE hinst, USHORT id, int cxDesired, int cyDesired, UINT load) … … 152 152 using namespace boost::adaptors; 153 153 154 auto accel = GetResourceWithSize(hinst, id, RT_ACCELERATOR);154 auto accel = LoadResourceAltWithSize(hinst, id, RT_ACCELERATOR); 155 155 if (accel.first == nullptr) 156 156 { … … 173 173 HMENU LoadMenuAlt(HINSTANCE hinst, USHORT id) 174 174 { 175 return LoadMenuIndirect( GetResource(hinst, id, RT_MENU));175 return LoadMenuIndirect(LoadResourceAlt(hinst, id, RT_MENU)); 176 176 } 177 177 178 178 INT_PTR DialogBoxAlt(HINSTANCE hinst, USHORT id, HWND hwndParent, DLGPROC dialogFunc, LPARAM initParam) 179 179 { 180 auto dlgTemplate = static_cast<DLGTEMPLATE*>( GetResource(hinst, id, RT_DIALOG));180 auto dlgTemplate = static_cast<DLGTEMPLATE*>(LoadResourceAlt(hinst, id, RT_DIALOG)); 181 181 return ::DialogBoxIndirectParam(hinst, dlgTemplate, hwndParent, dialogFunc, initParam); 182 182 } … … 184 184 HWND CreateDialogAlt(HINSTANCE hinst, USHORT id, HWND hwndParent, DLGPROC dialogFunc, LPARAM initParam) 185 185 { 186 auto dlgTemplate = static_cast<DLGTEMPLATE*>( GetResource(hinst, id, RT_DIALOG));186 auto dlgTemplate = static_cast<DLGTEMPLATE*>(LoadResourceAlt(hinst, id, RT_DIALOG)); 187 187 return ::CreateDialogIndirectParam(hinst, dlgTemplate, hwndParent, dialogFunc, initParam); 188 188 } … … 191 191 { 192 192 WTL::CDC dc = ::GetDC(nullptr); 193 auto pbi = static_cast<BITMAPINFO const*>( GetResource(hinst, id, RT_BITMAP));193 auto pbi = static_cast<BITMAPINFO const*>(LoadResourceAlt(hinst, id, RT_BITMAP)); 194 194 return CreateDIBitmap(dc, &pbi->bmiHeader, CBM_INIT, reinterpret_cast<BYTE const*>(pbi) + pbi->bmiHeader.biSize, pbi, DIB_RGB_COLORS); 195 195 }
Note:
See TracChangeset
for help on using the changeset viewer.