To create the component you should:
1. Open MS Visual C++
2. Choose File - > New
3. Select ATL COM AppWizard in Projects tab

4.Type the name, i.e Tonec1. Click OK button.
5.On the next screen, click Finish button.

6.Add new ATL object. Insert -> New ATL Object

7.Choose Objects in Category list, and select Simple Objects icon

8.Type the component name. LongBeep for example

9.Add new method to the newly created object. Right click on Ibeep item and select
Add Method in pop-up menu.
10. Choose the type of input parameters for the component. Method name: BeepSound. Parameters:
[in] long Frequency, [in] long Duration

11. Add the following line of code to ÑlongBeep.cpp file.
STDMETHODIMP CLongBeep::BeepSound(long Frequency, long Duration)
{
BOOL b1;
b1= Beep(Frequency, Duration);
return S_OK;
}
12. Compile the project (preferably with MinDependency option).
13. Register the component:
regsvr32 Tonec1.dll. (It's necessary even if you use the compiled component from the zip file below)