Playing a wav-File on Forms

Stefan_LimpertStefan_Limpert Member Posts: 30
edited 2010-04-30 in Navision Financials
Hi Folks,
I have a little problem. I like to play an arbitrary Wav-File when opening a form. How must I proceed? Is there a easy solution? The "Speaker-Beep" is so terrible,you know.

Comments

  • John_TegelaarJohn_Tegelaar Member Posts: 159
    It's fairly simple, if you have the Microsoft MultiMediacontrol available as OCX.

    1) Define "Sound" as a variable of type OCX, subtype "Microsoft Multimedia Control, version 6.0" (in my case, check yours)

    2) In the OnOpenForm trigger (or in fact, at any place you would like to play some sound) you put the following code:

    Sound.Notify := FALSE;
    Sound.Wait := TRUE;
    Sound.Shareable := FALSE;
    Sound.DeviceType := 'WaveAudio';
    Sound.FileName := 'C:\WINDOWS\MEDIA\CHIMES.WAV';
    Sound.Command := 'Open';
    Sound.command := 'Play';

    For 'filename' you can, of course, fill in any wave file you like and which is avaialble to all users.

    Small warning, though: Adding some sound can spice up the use of a program (Navision not excepted), but please be modest in the selection which sound you use for which event. Irritation isn't far away here.

    John
  • Stefan_LimpertStefan_Limpert Member Posts: 30
    Thanks John i will try it.
    Regards Stefan
  • Stefan_LimpertStefan_Limpert Member Posts: 30
    Hi John,
    I did not found the right OCX were you talking about.Where can I get it?
  • John_TegelaarJohn_Tegelaar Member Posts: 159
    Stefan,

    The filename of this OCX is MCI32.OCX in the Windows/System directory. I'm not sure if it's a standard Windows control, because I have a couple of development environments on my system. But I believe it comes with Windows Mediaplayer also.

    John
  • It4Ch1It4Ch1 Member Posts: 36
    I already downloaded and registered MCI32.OCX

    encountered error message:
    Could not invoke member Shareable. The OLE control or Automation server returned the following message:
    The number of elements provided is different from the number of arguments accepted by the method or property.

    any hints? :-k
Sign In or Register to comment.