Overlay Surface gives NoOverlayHardware Exception ?!!

Kenco1009

Newcomer
Joined
Aug 22, 2003
Messages
4
I want to create a DirectDraw Surface which is an overlay, but it gives me a NoOverlayHardwareException. I don't get why it does this, because a watch on the Device shows that it does support Overlays.

The code is like:


Dim desc As SurfaceDescription = New SurfaceDescription()
Dim caps As SurfaceCaps = New SurfaceCaps()
Dim dev as Device = New Device()
Dim overlay as Surface

desc.Width = 100
desc.Height = 100
desc.SurfaceCaps.Overlay = True
desc.SurfaceCaps.VideoMemory = True
overlay = New Surface(desc, dev)


The last line throws the exception. I put the .VideoMemory = True line in because a DirectX 7 article said you should to create an overlay surface. Despite the exception, dev.HardwareCaps.overlay returns true (which seems to say to me that Overlays ARE supported.
 
Update... for some reason it doesn't throw the NoOverlayHardware Exception; now it gives an InvalidPixelFormat Exception. With the Primary and OffScreenPlain surfaces that i have created i never needed to specify the Pixelformat, why do i have to do it for the overlay surface?

And what values do i have to fill in in the PixelFormat structure to make it work?
 
Back
Top