I found out why AlphaBlend fails. I try to AlphaBlend from a DC that is just a tiny bit out of the screen. If it is perfectly within the screen, AlphaBlend works great.
I am not sure however why this is so. If anybody knows, please just tell me!
문제
I am using AlphaBlend. Nothing special at all.
My code is working fine on Vista, Windows 7 and Windows 8, but not on Windows XP.
Usually AlphaBlend returns 1, but on XP it returns 0. I tested it on 2 XP computers.
I am totally baffled.
GetLastError returns "Successfully completed".
I am pretty sure that AlphaBlend should work on XP. Does anybody have any idea how to go on?
My (VB6-) code is
Dim LBF As Long
Dim bf As BLENDFUNCTION
With bf
.BlendOp = AC_SRC_OVER
.SourceConstantAlpha = 255
End With
Call CopyMemory(LBF, bf, Len(bf)) 'Copy struct into a Long var
(... some other stuff here....)
Dim iRet&
iRet = AlphaBlend(Me.Picture1.hdc, 0, 0, lDestWidth, lDestHeight, lOtherDC, 0, 0, (rOtherWin.Right - rOtherWin.Left), (rOtherWin.Bottom - rOtherWin.Top), LBF)
All values are valid and as expected, but AlphaBlend returns 0 anway.
Thank you.
해결책
I found out why AlphaBlend fails. I try to AlphaBlend from a DC that is just a tiny bit out of the screen. If it is perfectly within the screen, AlphaBlend works great.
I am not sure however why this is so. If anybody knows, please just tell me!
다른 팁
According to the documentation for AlphaBlend: The source rectangle must lie completely within the source surface, otherwise an error occurs and the function returns FALSE.
http://msdn.microsoft.com/en-us/library/windows/desktop/dd183351(v=vs.85).aspx