I actually had a suspicion that they'd either both work, or neither would.

The problem as I see it was that you call GetDC upon creation and continue to use that throughout the life of the program. Unfortunatly you can't always gaurante that the DC will remain valid through out that time.

I think that windows was canceling that DC eventually which ment that when you came to WM_PAINT and you blitted to it windows defaulted to the Desktop DC or something.

The first way of fixing it was to change the DC that backbuffer was blitted to, from myDC to the one which BeginPaint returned as this was pretty much gaurateed to be valid. You had actually had most of the code in place to do just this, I only needed to make a slight change.

The second easier solution is to use CS_OWNDC as a window class style as this ensures that the same DC remains valid for a window. Thereofre myDC and the DC returned by BeginPaint should always be the same.

So thats my utterly uneducated guess as to whats was happening, don't you just love Windows :grin: Anyway personally I always use CS_OWNDC as it makes life easier to be able to stick with a global variable like myDC, rather than having to pass Dcs returned by BeginPaint as parameters and the like.

Don't worry about the third file, that was only to help to find the problem should the first two fail, it wasn't going to solve it itself.

BTW, you have an interesting coding style, why do you always use English name for variables and procs yet the text is in german (I presume)? Just curious :)
Posted on 2002-06-11 12:58:37 by Eóin
ok, thank you again E?in!!! you helped me a lot!!

to my coding style:
you have an interesting coding style
...erm, is this meant negativly or positivly :tongue: ?

i use english names for variables and procs because it sounds more professional :grin: and for cases like this: i need to paste a code snippet or even the whole code, so that people can help me, it is easier for them to follow the code then. the buttons and the other stuff (like text) is german, because this is gonna be a game for some friends in school (originally you play it with a sheet of paper and some pencils :) ).

perhaps I'll release an english version too.. :)

btw: thank you for the good explanation..i got what ya mean..

NOP
Posted on 2002-06-11 13:06:35 by NOP-erator