I've come across the problem of generating a WSERV 10 error when activating an already active graphics context a couple of times now.

For me it mainly occurs when I have a function that draws something to the screen, that I call both in the Draw() function and also from other code. Ie, when coming from the Draw() function the graphics context is already active, so when I try to activate it I get WSERV 10.

Does anyone know an easy way around this problem? Is it possible to check if the current graphics context is active, or wait until it is de-activated?

Currently I have to either use a global variable or an extra input parameter to the relevant function telling it whether or not it's been called from the Draw() function. I'd much rather have a piece of local code to handle this situation though.

Thanks in advance!