|Microsoft DirectX 9.0|
The Lock method acquires or releases a lock on the DMO. Call this method to keep the DMO serialized when performing multiple operations.
HRESULT Lock( LONG bLock );
Value that specifies whether to acquire or release the lock. If the value is non-zero, a lock is acquired. If the value is zero, the lock is released.
Returns an HRESULT value. Possible values include those in the following table.
This method prevents other threads from calling methods on the DMO. If another thread calls a method on the DMO, the thread blocks until the lock is released.
Implementation Note: If you are using the Active Template Library (ATL) to implement a DMO, the name of the Lock method conflicts with the CComObjectRootEx::Lock method. To work around this problem, define the preprocessor symbol FIX_LOCK_NAME before including the header file Dmo.h:
#define FIX_LOCK_NAME #include <dmo.h>
This directive causes the preprocessor to rename the IMediaObject method to DMOLock. In your DMO, implement the method as DMOLock. In your implementation, call the ATL Lock or Unlock method, depending on the value of bLock. Applications can still invoke the method using the name Lock, because the vtable order does not change.