共用方式為


Vibrate

Send Feedback

This function plays the specified vibration song.

HRESULT Vibrate(
  DWORD cvn,
  const VIBRATENOTE * rgvn,
  BOOL fRepeat,
  DWORD dwTimeout
);

Parameters

  • cvn
    [in] The number of elements in the rgvn array (the number of notes in the song). If the value of this parameter is 0 and the value of rgvn is NULL, the Vibrate function will use the default amplitude and frequency for the note to be played, and will play this single note for the duration specified by dwTimeout.
  • rgvn
    [in] An array of VIBRATENOTE structures, each of which contains one vibration note. This array of vibration notes defines the vibration song to be played. If the value of this parameter is NULL and the value of cvn is 0, the Vibrate function will use the default amplitude and frequency for the note to be played, and will play this single note for the duration specified by dwTimeout.
  • fRepeat
    [in] A Boolean value that indicates whether the song should be repeated. If this parameter is equal to TRUE, it will refer to dwTimeout to determine how long the vibration song should play.
  • dwTimeout
    [in] The maximum amount of time, in milliseconds, that the vibration song will play. If the value of this parameter is set to INFINITE, the song will continue to play until the VibrateStop function is called.

Return Values

Value Description
E_FAIL The function failed to play the vibration song. Ensure that the VibrateGetDeviceCaps function was called prior to calling the Vibrate function. The device must be present before the Vibrate function is called.
E_NOTIMPL The specified feature is not implemented.
S_OK The function played the vibration song successfully.

Example

The following sample code will play a standard vibration song using the default amplitude and frequency for the single note. The vibration song will play until stopped because the dwTimeout parameter is set to INFINITE.

hr = Vibrate (0, NULL, TRUE, INFINITE);

Requirements

Pocket PC: Not supported
Smartphone: Smartphone 2002 and later
OS Versions: Windows CE 3.0 and later
Header: Declared in vibrate.h
Library: Use aygshell.lib

See Also

VibrateGetDeviceCaps

VIBRATENOTE

VibrateStop

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.