home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2000 May / PCP163A.iso / Runimage / Cbuilder4 / Examples / Apps / SysSound / MAINFORM.CPP next >
Encoding:
C/C++ Source or Header  |  1999-01-26  |  1.7 KB  |  43 lines

  1. //----------------------------------------------------------------------------
  2. //Borland C++Builder
  3. //Copyright (c) 1987, 1998 Borland International Inc. All Rights Reserved.
  4. //----------------------------------------------------------------------------
  5. //---------------------------------------------------------------------------
  6. #include <vcl.h>
  7. #pragma hdrstop
  8.  
  9. #include "mainform.h"
  10. //---------------------------------------------------------------------------
  11. #pragma resource "*.dfm"
  12. TForm1 *Form1;
  13. soundinfo sounds[] = {
  14.                         {"Standard", 0xFFFFFF, "0xFFFFFF"},
  15.                         {"Asterisk", MB_ICONASTERISK, "MB_ICONASTERISK"},
  16.                         {"Exclamation", MB_ICONEXCLAMATION, "MB_ICONEXCLAMATION"},
  17.                         {"Hand", MB_ICONHAND, "MB_ICONHAND"},
  18.                         {"Question", MB_ICONQUESTION, "MB_ICONQUESTION"},
  19.                         {"Default", MB_OK, "MB_OK"}
  20.                      };
  21. //---------------------------------------------------------------------------
  22. __fastcall TForm1::TForm1(TComponent* Owner)
  23.     : TForm(Owner)
  24. {
  25. }
  26. //---------------------------------------------------------------------------
  27. void __fastcall TForm1::Button1Click(TObject *Sender)
  28. {
  29.     for (int x=0; x<6; x++)
  30.         if (ListBox1->Selected[x])
  31.         {
  32.             MessageBeep(sounds[x].value);
  33.             Label2->Caption = "MessageBeep(" + AnsiString(sounds[x].param) + ");";
  34.         }
  35. }
  36. //---------------------------------------------------------------------------
  37. void __fastcall TForm1::FormCreate(TObject *Sender)
  38. {
  39.     for (int x=0; x<6; x++)
  40.         ListBox1->Items->Add(sounds[x].name);
  41. }
  42. //---------------------------------------------------------------------------
  43.