Changeset 861
- Timestamp:
- 1/6/2009 7:55:31 AM (4 years ago)
- File:
-
- 1 edited
-
branches/eraser6/ShellExt/CtxMenu.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eraser6/ShellExt/CtxMenu.cpp
r851 r861 285 285 osvi.dwMajorVersion >= 6) 286 286 { 287 mii.fMask |= MIIM_ CHECKMARKS;288 mii.hbmp Unchecked= GetMenuBitmap();287 mii.fMask |= MIIM_BITMAP; 288 mii.hbmpItem = GetMenuBitmap(); 289 289 } 290 290 else if (InvokeReason != INVOKEREASON_DRAGDROP) … … 780 780 int smIconSize = GetSystemMetrics(SM_CXMENUCHECK); 781 781 return static_cast<HICON>(LoadImage(theApp.m_hInstance, L"Eraser", 782 IMAGE_ICON, smIconSize, smIconSize, LR_ LOADTRANSPARENT));782 IMAGE_ICON, smIconSize, smIconSize, LR_DEFAULTCOLOR)); 783 783 } 784 784 … … 802 802 803 803 //Try converting the DDB into a DIB. 804 DIBSECTION dibSection;804 Handle<HDC> hdcDest = CreateCompatibleDC(NULL); 805 805 HBITMAP dib = CreateDIB(bitmap.bmWidth, bitmap.bmHeight, NULL); 806 if (!GetObject(dib, sizeof(dibSection), &dibSection) || 807 !GetDIBits(CreateCompatibleDC(NULL), iconInfo.hbmColor, 0, bitmap.bmHeight, 808 dibSection.dsBm.bmBits, reinterpret_cast<BITMAPINFO*>(&dibSection.dsBmih), 809 DIB_RGB_COLORS)) 810 { 811 return iconInfo.hbmColor; 806 SelectObject(hdcDest, dib); 807 808 typedef HRESULT (__stdcall *pBufferedPaintInit)(void); 809 static HMODULE uxTheme = LoadLibrary(L"UxTheme.dll"); 810 static pBufferedPaintInit BufferedPaintInit = 811 reinterpret_cast<pBufferedPaintInit>(GetProcAddress(uxTheme, "BufferedPaintInit")); 812 if (BufferedPaintInit) 813 { 814 typedef HPAINTBUFFER (_stdcall *pBeginBufferedPaint)(HDC hdcTarget, const RECT* prcTarget, 815 BP_BUFFERFORMAT dwFormat, BP_PAINTPARAMS* pPaintParams, HDC* phdc); 816 typedef HRESULT (__stdcall *pEndBufferedPaint)(HPAINTBUFFER hBufferedPaint, 817 BOOL fUpdateTarget); 818 static pBeginBufferedPaint BeginBufferedPaint = 819 reinterpret_cast<pBeginBufferedPaint>(GetProcAddress(uxTheme, "BeginBufferedPaint")); 820 static pEndBufferedPaint EndBufferedPaint = 821 reinterpret_cast<pEndBufferedPaint>(GetProcAddress(uxTheme, "EndBufferedPaint")); 822 823 BLENDFUNCTION blendFunc = { AC_SRC_OVER, 0, 255, AC_SRC_ALPHA }; 824 BP_PAINTPARAMS paintParams; 825 paintParams.cbSize = sizeof(paintParams); 826 paintParams.dwFlags = BPPF_ERASE; 827 paintParams.prcExclude = NULL; 828 paintParams.pBlendFunction = &blendFunc; 829 830 HDC hdcBuffer; 831 RECT iconRect = { 0, 0, bitmap.bmWidth, bitmap.bmHeight }; 832 HPAINTBUFFER hPaintBuffer = BeginBufferedPaint(hdcDest, &iconRect, BPBF_DIB, 833 &paintParams, &hdcBuffer); 834 835 if (hPaintBuffer) 836 { 837 DrawIconEx(hdcBuffer, 0, 0, icon, bitmap.bmWidth, bitmap.bmHeight, 0, 838 NULL, DI_NORMAL); 839 EndBufferedPaint(hPaintBuffer, TRUE); 840 } 841 } 842 else 843 { 844 DIBSECTION dibSection; 845 if (!GetObject(dib, sizeof(dibSection), &dibSection)) 846 return iconInfo.hbmColor; 847 if (!GetDIBits(hdcDest, iconInfo.hbmColor, 0, bitmap.bmHeight, 848 dibSection.dsBm.bmBits, reinterpret_cast<BITMAPINFO*>(&dibSection.dsBmih), 849 DIB_RGB_COLORS)) 850 return iconInfo.hbmColor; 812 851 } 813 852 … … 824 863 info.bmiHeader.biPlanes = 1; 825 864 info.bmiHeader.biBitCount = 32; 826 info.bmiHeader.biCompression = BI_RGB; 827 char* dibBitmapBits = NULL;828 return ::CreateDIBSection( 0, &info, DIB_RGB_COLORS,829 reinterpret_cast<void**>(bitmapBits ? bitmapBits : &dibBitmapBits), NULL, 0);865 866 Handle<HDC> screenDC(GetDC(NULL)); 867 return ::CreateDIBSection(screenDC, &info, DIB_RGB_COLORS, 868 reinterpret_cast<void**>(bitmapBits), NULL, 0); 830 869 } 831 870 }
Note: See TracChangeset
for help on using the changeset viewer.
