Ignore:
Timestamp:
Feb 1, 2011, 11:13:15 PM (13 years ago)
Author:
イグトランス (egtra)
Message:

プロパティシート周りを9x対応させた

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/egtra/ab5.0/abdev/abdev-impl/Resource/Load.cpp

    r795 r797  
    3535}
    3636
    37 void* GetResource(HINSTANCE hinst, USHORT id, LPCTSTR type)
     37HICON 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
     50void* LoadResourceAlt(HINSTANCE hinst, USHORT id, LPCTSTR type)
    3851{
    3952    if (auto hrsrc = ::FindResource(hinst, MAKEINTRESOURCE(id), type))
     
    4760}
    4861
    49 std::pair<void*, DWORD> GetResourceWithSize(HINSTANCE hinst, USHORT id, LPCTSTR type)
     62std::pair<void*, DWORD> LoadResourceAltWithSize(HINSTANCE hinst, USHORT id, LPCTSTR type)
    5063{
    5164    typedef std::pair<void*, DWORD> result_type;
     
    6477    return result_type(nullptr, 0);
    6578}
    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 namespace
    7979
    8080HICON LoadIconAlt(HINSTANCE hinst, USHORT id, int cxDesired, int cyDesired, UINT load)
     
    152152    using namespace boost::adaptors;
    153153
    154     auto accel = GetResourceWithSize(hinst, id, RT_ACCELERATOR);
     154    auto accel = LoadResourceAltWithSize(hinst, id, RT_ACCELERATOR);
    155155    if (accel.first == nullptr)
    156156    {
     
    173173HMENU LoadMenuAlt(HINSTANCE hinst, USHORT id)
    174174{
    175     return LoadMenuIndirect(GetResource(hinst, id, RT_MENU));
     175    return LoadMenuIndirect(LoadResourceAlt(hinst, id, RT_MENU));
    176176}
    177177
    178178INT_PTR DialogBoxAlt(HINSTANCE hinst, USHORT id, HWND hwndParent, DLGPROC dialogFunc, LPARAM initParam)
    179179{
    180     auto dlgTemplate = static_cast<DLGTEMPLATE*>(GetResource(hinst, id, RT_DIALOG));
     180    auto dlgTemplate = static_cast<DLGTEMPLATE*>(LoadResourceAlt(hinst, id, RT_DIALOG));
    181181    return ::DialogBoxIndirectParam(hinst, dlgTemplate, hwndParent, dialogFunc, initParam);
    182182}
     
    184184HWND CreateDialogAlt(HINSTANCE hinst, USHORT id, HWND hwndParent, DLGPROC dialogFunc, LPARAM initParam)
    185185{
    186     auto dlgTemplate = static_cast<DLGTEMPLATE*>(GetResource(hinst, id, RT_DIALOG));
     186    auto dlgTemplate = static_cast<DLGTEMPLATE*>(LoadResourceAlt(hinst, id, RT_DIALOG));
    187187    return ::CreateDialogIndirectParam(hinst, dlgTemplate, hwndParent, dialogFunc, initParam);
    188188}
     
    191191{
    192192    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));
    194194    return CreateDIBitmap(dc, &pbi->bmiHeader, CBM_INIT, reinterpret_cast<BYTE const*>(pbi) + pbi->bmiHeader.biSize, pbi, DIB_RGB_COLORS);
    195195}
Note: See TracChangeset for help on using the changeset viewer.