Experimental results
I have determined experimentally (Windows Vista Home Premium), however, that:
This flashing is eliminated by including the code to acquire and release the screen as shown in Listing 5.
There may be a better way to eliminate the flashing.
However, I can't tell you what it is at this time.