The line
BitBlt(hdcBitmap, 0, 0, bmA.Width, bmA.Height, hdcScreen, 0, 0, SRCCOPY);
seem to be missing in version
XORCycleA
.
What I would think if that even though the bitmap
bmA
contains the image,
hdcBitmap
is black without initializing its content from the screen.
Well probably 10 years have elasped since last time I have used
BitBlt
. At that time,to help debugging, my code was made in a way that I could write directly to the screen instead of in-memory. That way, when I have some problem, I run the debugger so that it don't hide the part where I was drawing and the step through the code.
Create another file in that method and copy the content of
hdcBitmap
to a file to see if it does what you think.
By the way, the final result is dependent on the order of calling
XORCycleA
and
XORCycleB
and the result might differ depending on the system (XP, Vista or Windows 7). In fact, it seems to be related to animation thus the only way to have consistent result is to put a breakpoint (and then rezise the form to force a paint) and ignore the first time the code is called since the first generated result would have the form fading in...
Thus is was not so simple as copying the code... As it was a console application, we had to add reference to make it work (then allows unsafe code) and then understand the subtilities...
Once the
SRCCOPY
and
TextOut
lines are added to
XORCycleA
, both function give essentially the same "after" image (except initially because of the fading of the form in progress that affect the first generated image).