다음을 통해 공유


CBaseReferenceClock::AdvisePeriodic (Windows CE 5.0)

Send Feedback

Sets up a recurring advise with the reference clock.

HRESULT AdvisePeriodic(REFERENCE_TIMEStartTime,REFERENCE_TIMEPeriodTime,HSEMAPHOREhSemaphore,DWORD* pdwAdviseToken);

Parameters

  • StartTime
    Start at this time.
  • PeriodTime
    Time between notifications.
  • hSemaphore
    Advise through a semaphore.
  • pdwAdviseToken
    Advise token that identifies the link with the clock.

Return Values

Returns one of the following HRESULT values.

Value Description
E_OUTOFMEMORY Out of memory.
E_INVALIDARG Invalid argument.
NOERROR No error.

Remarks

A semaphore, rather than an event, is used to ensure that multiple notifications can be seen by the user.

Each time an amount of time specified in the PeriodTime parameter elapses, the semaphore is released.

When no further notifications are required, call CBaseReferenceClock::Unadvise and pass the pdwAdviseToken value returned from this call.

For example, the following code extract sets up an advise link that fires its first advise five seconds from now and then signals every second until Unadvise is called. By using a semaphore with a count of 10, the clock is effectively able to cache 10 events.

HANDLE hSemaphore = CreateSemaphore(NULL, 0, 10, NULL);
    // Assume pRefClock is an IReferenceClock* variable.

    REFERENCE_TIME rtPeriodTime = 1000 * (UNITS / MILLISECONDS);
        // A one-second interval
    REFERENCE_TIME rtNow;
    DWORD    dwAdviseToken;
    pRefClock->GetTime(&rtNow);

    pRefClock->AdvisePeriodic(rtNow+(5*rtPeriodTime),
        PeriodTime, hSemaphore, &dwAdviseToken);

Requirements

DirectShow applications and DirectShow filters have different include file and link library requirements.

For more information, see Setting Up the Build Environment.

OS Versions: Windows CE 2.12 and later. Version 2.12 requires DXPAK 1.0 or later.
Header:

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.