IDXSurface::LockSurfaceDC Method

This topic documents a feature of Visual Filters and Transitions, which is deprecated as of Windows Internet Explorer 9 and obsolete as of Internet Explorer 10.

Locks a region of the surface and returns an IDXDCLock interface.


HRESULT LockSurfaceDC(
    const DXBNDS *pBounds,
    ULONG ulTimeOut,
    DWORD dwFlags,
    IDXDCLock **ppDCLock


[in] Pointer to the region to lock, as specified by the DXBNDS structure. If NULL, the entire surface is locked.
[in] Time, in milliseconds, to wait for the lock to be obtained. You can use INFINITE for this parameter. If the lock fails because of a time-out, the call returns E_ABORT.
[in] DWORD value that indicates the lock type. Specify DXLOCKF_READ for read-only access or DXLOCKF_READWRITE for read/write access to the surface.
[out] Address of a pointer to the IDXDCLock interface.

Return Value

Returns an HRESULT value that depends on the implementation of the interface.


This method is similar to the IDXSurface::LockSurface but is used to gain access to the surface's handle to a device context (HDC) so that Microsoft Win32  Windows Graphics Device Interface (GDI) operations can be performed on the data. Many surfaces, such as procedural surfaces, will not have an associated HDC, so this call might return E_NOTIMPL. In this case, if an HDC is required, you can use the IDXSurfaceFactory::CopySurfaceToNewFormat method to obtain a DXSurface that supports an HDC.

The locking semantics are similar to IDXSurface::LockSurface, and subregions of the surface can be locked for reading or writing. One important difference is that all HDC locks are not relative to the locked region. In addition, the HDC references the entire surface, regardless of the bounds locked.

The returned interface supports only a single method: IDXDCLock::GetDC, which returns an HDC. The HDC returned is valid for the entire time that a reference is held on the IDXDCLock object. When the object is released by means of Release, the HDC is released and the caller should not use it again.

Community Additions

© 2014 Microsoft