Yesterday when I was testing my game out, written from scratch, my DirectX debugger suddenly started spewing out this error code after a couple of runs of the program. Now, this error appears just a couple of seconds after the program goes fullscreen and starts rendering some graphics and then it 'tabs' out of the fullscreen and yield the same result if I try to 'tab' back in.
Direct3D9: :WM_ACTIVATEAPP: BEGIN Deactivating app pid=XXXXXXXX, tid=XXXXXXXX
Direct3D9: (INFO) :DDI threading stopped
Direct3D9: :INACTIVE: XXXXXXXX: Restoring original mode (1280x1024x22x60) at adapter index 0
Direct3D9: :*** Active state changing
Direct3D9: :WM_ACTIVATEAPP: DONE Deactivating app pid=XXXXXXXX, tid=XXXXXXXX
Direct3D9: (ERROR) :Lost due to display uniqueness change
The first thing I did was google, and found some people who had had the same problem, and they'd tested some methods, none of which solved my case.
I started fibbling around with the code, turning off the OnResetDevice() to see if it was the TestCooperativeLevel's fault. Nope.
Turned off the rendering. Nope.
Tested a wait method after creating the D3D device before starting to render the scene to see if it needed time to adapt...(or something). Nope.
Since I'm running on Vista and a person had talked about issues with Vista and fullscreen mode and said I should try IDirect3DDevice9Ex, the extension that apparently could solve my problem. Yielded the same results. Nope.
The program ran fine in windowed mode, so obviously there shouldn't be any errors in the code. Anyway...
I decided to see if it could be a hardware issue or something of that nature. I tested the LPDIRECT3D9::CheckDeviceFormat and LPDIRECT3D9::CheckDeviceMultiSample type. Yielded no result.
I turned off the computer, went to bed, woke up, turned it on, and NOW it works again. No changes to the code.
So my question (finally) is: Why does this happen, on occasions? It has happened before.
EDIT: I should probably mention that this usually occur after alot of running several instances (starting the app, closing the app, starting the app....).