DirectX SDK |
The DirectDrawSurface7.Lock method obtains a pointer to the surface memory.
object.Lock( _ r As RECT, _ desc As DDSURFACEDESC2, _ flags As CONST_DDLOCKFLAGS, _ hnd As Long)
If the method fails, it raises an error, and Err.Number can be set to one of the following values:
DDERR_INVALIDOBJECT |
DDERR_INVALIDPARAMS |
DDERR_OUTOFMEMORY |
DDERR_SURFACEBUSY |
DDERR_SURFACELOST |
DDERR_WASSTILLDRAWING |
For more information on using this method, see Accessing Surface Memory Directly.
After retrieving a surface memory pointer, you can access the surface memory until a corresponding DirectDrawSurface7.Unlock method is called. When the surface is unlocked, the pointer to the surface memory is invalid.
Do not call DirectDraw blit functions to blit from a locked region of a surface. If you do, the blit returns either DDERR_SURFACEBUSY or DDERR_LOCKEDSURFACES. GDI blit functions also silently fail when used on a locked video-memory surface.
This method often causes DirectDraw to hold the Win16Mutex (also known as Win16Lock) until you call the DirectDrawSurface7.Unlock method. GUI debuggers cannot operate while the Win16Mutex is held.
DirectDrawSurface7.Unlock, DirectDrawSurface7.GetDC, DirectDrawSurface7.ReleaseDC