|
|
|
|
Forum
Please
Log In
to post a new message or reply to an existing one. If you are not registered, please
register.
NOTE: Some forums may be read-only if you are not currently subscribed to
our technical support services.
Subject |
Author |
Date |
|
himanshu joshi
|
Mar 19, 2007 - 4:19 AM
|
Hi
I am trying to load a .png value as wallpaper to my application. However it is giving me following error CExtBitmapCache::AlphaBlend’ : function does not take 3 arguments I tried using 6 different formats of AlphaBlend still facing the same problem Could you rectify the below code and suggest some solution
CExtSkinBitmap pBitmap; LPCTSTR strPngImageResourceID; LPCTSTR strPngResourceSection; HRSRC hRsrc; CRect rectInside; GetClientRect(rectInside); strPngImageResourceID = MAKEINTRESOURCE(IDB_SPLASHR2); strPngResourceSection = _T("PNG"); hRsrc = ::FindResource(AfxGetInstanceHandle(), strPngImageResourceID, strPngResourceSection ); ASSERT(hRsrc); VERIFY(pBitmap.LoadPNG_Resource(AfxGetInstanceHandle(),hRsrc)); HDC hDc= ::GetDC(AfxGetMainWnd()->m_hWnd); pBitmap.AlphaBlend(hDc,&rectInside,255);
|
|
Suhai Gyorgy
|
Mar 19, 2007 - 5:22 AM
|
The problem seems to be that the format you’d like to use is not declared as virtual function in CExtBitmap class. I used the following class to make it compile successfully: class CMySkinBitmap : public CExtSkinBitmap
{
public:
virtual int AlphaBlend(
HDC hDC,
const RECT & rcDst,
BYTE nSCA = 0xFF) const
{
return CExtBitmap::AlphaBlend(hDC, rcDst, nSCA);
}
};
And then use this class instead of CExtSkinBitmap. I hope it will work, I didn’t test it running.
|
|
Suhai Gyorgy
|
Mar 19, 2007 - 4:35 AM
|
It seems you would like to use the following format of AlphaBlend: int AlphaBlend(HDC hDC, const RECT & rcDst, BYTE nSCA = 0xFF) const; In this format, the second parameter is a rect given as a reference-parameter, but not as a pointer. In your call pBitmap.AlphaBlend(hDc,&rectInside,255); the second parameter is a pointer to a rect. So try calling pBitmap.AlphaBlend(hDc,rectInside,255); , which could be really pBitmap.AlphaBlend(hDc,rectInside); as the third parameter’s default value is the same (0xFF = 255).
|
|