Changeset 797 in dev for branches/egtra/ab5.0
- Timestamp:
- Feb 1, 2011, 11:13:15 PM (14 years ago)
- Location:
- branches/egtra/ab5.0/abdev
- Files:
-
- 3 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 } -
branches/egtra/ab5.0/abdev/abdev-impl/Resource/Load.h
r795 r797 1 1 #pragma once 2 2 3 #include <utility> 3 4 #include <memory> 4 5 #include <windows.h> … … 6 7 7 8 namespace ActiveBasic { namespace Resource { 9 10 void* LoadResourceAlt(HINSTANCE hinst, USHORT id, LPCTSTR type); 11 std::pair<void*, DWORD> LoadResourceAltWithSize(HINSTANCE hinst, USHORT id, LPCTSTR type); 8 12 9 13 HICON LoadIconAlt(HINSTANCE hinst, USHORT id, int cxDesired, int cyDesired, UINT load = 0); -
branches/egtra/ab5.0/abdev/abdev/DialogBoxes.cpp
r793 r797 502 502 void DlgNewProjectWizard(HWND hwnd){ 503 503 #define MAX_NEWPROJECTPAGE 3 504 PROPSHEETHEADER psh ;505 PROPSHEETPAGE psp ;506 HPROPSHEETPAGE hpsp[MAX_NEWPROJECTPAGE] ;504 PROPSHEETHEADER psh = {}; 505 PROPSHEETPAGE psp = {}; 506 HPROPSHEETPAGE hpsp[MAX_NEWPROJECTPAGE] = {}; 507 507 int i; 508 508 509 psp.dwSize =sizeof(PROPSHEETPAGE);510 psp.hInstance =hResInst;511 psp.dwFlags =PSP_DEFAULT;509 psp.dwSize = sizeof(PROPSHEETPAGE); 510 psp.hInstance = GetWindowInstance(hwnd); 511 psp.dwFlags = PSP_DLGINDIRECT; 512 512 513 513 //各ページのセッティング 514 514 i=0; 515 psp.p szTemplate=MAKEINTRESOURCE(IDD_NEWPROJECT_PAGE1);515 psp.pResource = static_cast<PROPSHEETPAGE_RESOURCE>(ActiveBasic::Resource::LoadResourceAlt(hResInst, IDD_NEWPROJECT_PAGE1, RT_DIALOG)); 516 516 psp.pfnDlgProc=DlgNewProject_Page1; 517 517 hpsp[i]=CreatePropertySheetPage(&psp); 518 518 i++; 519 psp.p szTemplate=MAKEINTRESOURCE(IDD_NEWPROJECT_PAGE2);519 psp.pResource = static_cast<PROPSHEETPAGE_RESOURCE>(ActiveBasic::Resource::LoadResourceAlt(hResInst, IDD_NEWPROJECT_PAGE2, RT_DIALOG)); 520 520 psp.pfnDlgProc=DlgNewProject_Page2; 521 521 hpsp[i]=CreatePropertySheetPage(&psp); 522 522 i++; 523 psp.p szTemplate=MAKEINTRESOURCE(IDD_NEWPROJECT_PAGE3);523 psp.pResource = static_cast<PROPSHEETPAGE_RESOURCE>(ActiveBasic::Resource::LoadResourceAlt(hResInst, IDD_NEWPROJECT_PAGE3, RT_DIALOG)); 524 524 psp.pfnDlgProc=DlgNewProject_Page3; 525 525 hpsp[i]=CreatePropertySheetPage(&psp); … … 967 967 } 968 968 void DlgProjectOptionSetting(HWND hwnd){ 969 PROPSHEETHEADER psh ;970 PROPSHEETPAGE psp[MAX_PJSETDLG] ;971 HPROPSHEETPAGE hpsp[MAX_PJSETDLG] ;969 PROPSHEETHEADER psh = {}; 970 PROPSHEETPAGE psp[MAX_PJSETDLG] = {}; 971 HPROPSHEETPAGE hpsp[MAX_PJSETDLG] = {}; 972 972 int i; 973 973 memset(&SetSwitch,0,MAX_PJSETDLG); … … 976 976 i=0; 977 977 psp[i].dwSize=sizeof(PROPSHEETPAGE); 978 psp[i].dwFlags =PSP_DEFAULT;979 psp[i].hInstance =hResInst;980 psp[i].p szTemplate=MAKEINTRESOURCE(IDD_PJ_OPTION1);981 psp[i].pfnDlgProc =(DLGPROC)DlgProjectOption_Whole;978 psp[i].dwFlags = PSP_DLGINDIRECT; 979 psp[i].hInstance = GetWindowInstance(hwnd); 980 psp[i].pResource = static_cast<PROPSHEETPAGE_RESOURCE>(ActiveBasic::Resource::LoadResourceAlt(hResInst, IDD_PJ_OPTION1, RT_DIALOG)); 981 psp[i].pfnDlgProc = DlgProjectOption_Whole; 982 982 hpsp[i]=CreatePropertySheetPage(&psp[i]); 983 983 i++; 984 984 psp[i].dwSize=sizeof(PROPSHEETPAGE); 985 psp[i].dwFlags=PSP_D EFAULT;986 psp[i].hInstance =hResInst;987 psp[i].p szTemplate=MAKEINTRESOURCE(IDD_PJ_OPTION2);988 psp[i].pfnDlgProc =(DLGPROC)DlgProjectOption_Win32API;985 psp[i].dwFlags=PSP_DLGINDIRECT; 986 psp[i].hInstance = GetWindowInstance(hwnd); 987 psp[i].pResource = static_cast<PROPSHEETPAGE_RESOURCE>(ActiveBasic::Resource::LoadResourceAlt(hResInst, IDD_PJ_OPTION2, RT_DIALOG)); 988 psp[i].pfnDlgProc = DlgProjectOption_Win32API; 989 989 hpsp[i]=CreatePropertySheetPage(&psp[i]); 990 990 i++; 991 991 psp[i].dwSize=sizeof(PROPSHEETPAGE); 992 psp[i].dwFlags =PSP_DEFAULT;993 psp[i].hInstance =hResInst;994 psp[i].p szTemplate=MAKEINTRESOURCE(IDD_PJ_OPTION3);995 psp[i].pfnDlgProc =(DLGPROC)DlgProjectOption_Manifest;992 psp[i].dwFlags = PSP_DLGINDIRECT; 993 psp[i].hInstance = GetWindowInstance(hwnd); 994 psp[i].pResource = static_cast<PROPSHEETPAGE_RESOURCE>(ActiveBasic::Resource::LoadResourceAlt(hResInst, IDD_PJ_OPTION3, RT_DIALOG)); 995 psp[i].pfnDlgProc = DlgProjectOption_Manifest; 996 996 hpsp[i]=CreatePropertySheetPage(&psp[i]); 997 997 i++; 998 998 psp[i].dwSize=sizeof(PROPSHEETPAGE); 999 psp[i].dwFlags =PSP_DEFAULT;1000 psp[i].hInstance =hResInst;1001 psp[i].p szTemplate=MAKEINTRESOURCE(IDD_PJ_OPTION4);1002 psp[i].pfnDlgProc =(DLGPROC)DlgProjectOption_Debug;999 psp[i].dwFlags = PSP_DLGINDIRECT; 1000 psp[i].hInstance = GetWindowInstance(hwnd); 1001 psp[i].pResource = static_cast<PROPSHEETPAGE_RESOURCE>(ActiveBasic::Resource::LoadResourceAlt(hResInst, IDD_PJ_OPTION4, RT_DIALOG)); 1002 psp[i].pfnDlgProc = DlgProjectOption_Debug; 1003 1003 hpsp[i]=CreatePropertySheetPage(&psp[i]); 1004 1004 … … 1955 1955 return 0; 1956 1956 } 1957 PROPSHEETPAGE_RESOURCE LoadTest(HINSTANCE hinst, USHORT id, LPCTSTR type) 1958 { 1959 auto t = ActiveBasic::Resource::LoadResourceAltWithSize(hResInst, id, type); 1960 auto p = malloc(t.second); 1961 memcpy(p, t.first, t.second); 1962 return static_cast<PROPSHEETPAGE_RESOURCE>(p); 1963 } 1957 1964 void DlgOptionSetting(HWND hwnd){ 1958 PROPSHEETHEADER psh; 1965 HINSTANCE hinst = GetWindowInstance(hwnd); 1966 PROPSHEETHEADER psh = {}; 1959 1967 #define MAX_SETDLG 32 1960 PROPSHEETPAGE psp[MAX_SETDLG] ;1961 HPROPSHEETPAGE hpsp[MAX_SETDLG] ;1968 PROPSHEETPAGE psp[MAX_SETDLG] = {}; 1969 HPROPSHEETPAGE hpsp[MAX_SETDLG] = {}; 1962 1970 int i; 1963 1971 … … 1970 1978 i=0; 1971 1979 1980 1972 1981 //各ページのセッティング 1973 1982 psp[i].dwSize=sizeof(PROPSHEETPAGE); 1974 psp[i].dwFlags=PSP_D EFAULT;1975 psp[i].hInstance=h ResInst;1976 psp[i].p szTemplate=MAKEINTRESOURCE(IDD_OPTION_WHOLE);1977 psp[i].pfnDlgProc= (DLGPROC)Dlg_Option_Whole;1983 psp[i].dwFlags=PSP_DLGINDIRECT; 1984 psp[i].hInstance=hinst; 1985 psp[i].pResource = static_cast<PROPSHEETPAGE_RESOURCE>(LoadTest(hResInst, IDD_OPTION_WHOLE, RT_DIALOG)); 1986 psp[i].pfnDlgProc=Dlg_Option_Whole; 1978 1987 hpsp[i]=CreatePropertySheetPage(&psp[i]); 1979 1988 i++; 1980 1989 psp[i].dwSize=sizeof(PROPSHEETPAGE); 1981 psp[i].dwFlags=PSP_D EFAULT;1982 psp[i].hInstance=h ResInst;1983 psp[i].p szTemplate=MAKEINTRESOURCE(IDD_OPTION_EDITOR);1984 psp[i].pfnDlgProc= (DLGPROC)Dlg_Option_Editor;1990 psp[i].dwFlags=PSP_DLGINDIRECT; 1991 psp[i].hInstance=hinst; 1992 psp[i].pResource = static_cast<PROPSHEETPAGE_RESOURCE>(LoadTest(hResInst, IDD_OPTION_EDITOR, RT_DIALOG)); 1993 psp[i].pfnDlgProc=Dlg_Option_Editor; 1985 1994 hpsp[i]=CreatePropertySheetPage(&psp[i]); 1986 1995 i++; 1987 1996 psp[i].dwSize=sizeof(PROPSHEETPAGE); 1988 psp[i].dwFlags=PSP_D EFAULT;1989 psp[i].hInstance=h ResInst;1990 psp[i].p szTemplate=MAKEINTRESOURCE(IDD_OPTION_COLOR);1991 psp[i].pfnDlgProc= (DLGPROC)Dlg_Option_Color;1997 psp[i].dwFlags=PSP_DLGINDIRECT; 1998 psp[i].hInstance=hinst; 1999 psp[i].pResource = static_cast<PROPSHEETPAGE_RESOURCE>(LoadTest(hResInst, IDD_OPTION_COLOR, RT_DIALOG)); 2000 psp[i].pfnDlgProc=Dlg_Option_Color; 1992 2001 hpsp[i]=CreatePropertySheetPage(&psp[i]); 1993 2002 i++; 1994 2003 psp[i].dwSize=sizeof(PROPSHEETPAGE); 1995 psp[i].dwFlags=PSP_D EFAULT;1996 psp[i].hInstance=h ResInst;1997 psp[i].p szTemplate=MAKEINTRESOURCE(IDD_OPTION_TOOLBAR);1998 psp[i].pfnDlgProc= (DLGPROC)Dlg_Option_Toolbar;2004 psp[i].dwFlags=PSP_DLGINDIRECT; 2005 psp[i].hInstance=hinst; 2006 psp[i].pResource = static_cast<PROPSHEETPAGE_RESOURCE>(LoadTest(hResInst, IDD_OPTION_TOOLBAR, RT_DIALOG)); 2007 psp[i].pfnDlgProc=Dlg_Option_Toolbar; 1999 2008 hpsp[i]=CreatePropertySheetPage(&psp[i]); 2000 2009 … … 2003 2012 i++; 2004 2013 psp[i].dwSize=sizeof(PROPSHEETPAGE); 2005 psp[i].dwFlags=PSP_D EFAULT;2006 psp[i].hInstance=h ResInst;2007 psp[i].p szTemplate=MAKEINTRESOURCE(IDD_OPTION_RAD);2008 psp[i].pfnDlgProc= (DLGPROC)Dlg_Option_Rad;2014 psp[i].dwFlags=PSP_DLGINDIRECT; 2015 psp[i].hInstance=hinst; 2016 psp[i].pResource = static_cast<PROPSHEETPAGE_RESOURCE>(LoadTest(hResInst, IDD_OPTION_RAD, RT_DIALOG)); 2017 psp[i].pfnDlgProc=Dlg_Option_Rad; 2009 2018 hpsp[i]=CreatePropertySheetPage(&psp[i]); 2010 2019 #endif
Note:
See TracChangeset
for help on using the changeset viewer.