Reading back a rendering surface in .NET 2.0
I need to read back a large RGBA image to system memory in .NET 2.0. It appears that the documented function Surface.LockRectangle had disappeared from DX9 2.0. Another function, Surface.Lock exists, but I haven't found good examples of how to use it to get access to the pixels.
My render target buffer is named "backbuffer", (A8R8G8B8). By some trial and error, I got as far as the following (VB.NET code):
Dim MemSurfaceAs Surface = device.CreateOffscreenPlainSurface(outputsize, outputsize, Format.A8R8G8B8, Pool.SystemMemory)
device.GetRenderTargetData(backbuffer, MemSurface)
Dim GBAs GraphicsBuffer = MemSurface.Lock(New Rectangle(0, 0, outputsize, outputsize), LockFlags.None)
This code executes without generating any errors. However, when I examine the properties of GB, it shows me that the DataBufferPointer is void and the size of the buffer is 0 bytes. Trying to access the ElementCount property generates an "Attempted to divide by zero" exception. I tried modifying each parameter to each of the 3 calls, but I either get an exception or the same disappointing result.
1. Is this the most efficient way of accessing the rendering surface?
2. If so, what am I doing wrong in the code above?
Many thanks for any help!

