Copyright © 1998-2010 MultiMedia Soft

SetSoundFromMemory method

Previous pageReturn to chapter overviewNext page

Remarks

Changes at run-time one of the sounds associated to the various button states loading a WAV sound previously stored in memory.

 

Syntax

Visual Basic

control.SetSoundFromMemory (index as enumSounds, pDataInMemory as string, datasize as long) as integer

 

Visual C++

BOOL control.SetSoundFromMemory (long index, VARIANT pDataInMemory, long datasize);

 

Parameter

Description

 

 

index

Numerical value that represents the index of the sound property to change. Supported values are the following:

Mnemonic constant

Value

Meaning

SOUND_DOWN

0

Changes the SoundDown property

SOUND_UP

1

Changes the SoundUp property

SOUND_MOUSEOVER

2

Changes the SoundMouseOver property

SOUND_MOUSEOUT

3

Changes the SoundMouseOut property

pDataInMemory

Variant parameter containing the pointer to sound data previously loaded in memory.

datasize

Numerical value that represents the data size in bytes.

 

 

Visual Basic example

 

Dim bitssound As String

Dim length As Integer

bitssound = LoadResData(xxx, "WAVE")

length = LenB(bitssound)

BtnEnh1.SetSoundFromMemory SOUND_DOWN, bitssound, length

With this code the SoundDown property will be changed using a sound identified by xxx (contained in a .RES file).

 

Visual C++ example

 

VARIANT      va;

VariantInit (&va);

va.vt = VT_BYREF | VT_UI1;

va.pbVal = (BYTE *) pointer_to_sound_in_memory;

BtnEnh1.SetSoundFromMemory (SOUND_DOWN, va, size_of_data);

With this code the SoundDown property will be changed using a sound previously loaded in memory.

 

Return value

 

Value

Meaning

 

 

FALSE

The operation failed

TRUE

The operation was successful