I've done everything what you have said here, but my window flickers.

Can you tell me, what's wrong?

If you click in the window in the left top corner (like in 1x1 or 2x2 pixel) one of the lifts start to go upwards (it's a hidden programmer's testing functionality), so you can see how annoying the flickering is.

My programm:
www.wewnatrz.com/beta2/gfx/lifts.rar