General info | Getting started | Samples | Components reference | FAQ | Solutions

Getting started


Providers & consumers

Usually a number of VCX components work together, some act as providers, some as consumers, some both. Providers support consumers with data from their output stream. Components that may act as providers implements IvcproProvider interface. Components that may act as consumers implements IvcproConsumer interface. The simplest example is the link WaveIn => WaveOut when WaveIn is a provider and WaveOut is a consumer. You must make this link in runtime by calling IvcproProvider.AddConsumer method. Please look at the source code that does this:

C#
private void SetLink(VCProX.IvcproProvider provider,
	VCProX.IvcproConsumer consumer)
{
	provider.AddConsumer(consumer);
}

private void Form1_Load(object sender, System.EventArgs e)
{
	SetLink((VCProX.IvcproProvider)WaveIn.GetOcx(),
		(VCProX.IvcproConsumer)WaveOut.GetOcx());
}
		
VB.NET
Private Sub SetLink(provider As VCProX.IvcproProvider,
	consumer As VCProX.IvcproConsumer)

	provider.AddConsumer(consumer)
End Sub

Private Sub Form_Load()
	SetLink(WaveIn.GetOcx, WaveOut.GetOcx)
End Sub
		
VB 6.0
Private Sub SetLink(provider As VCProX.IvcproProvider,
	consumer As VCProX.IvcproConsumer)

	provider.AddConsumer consumer
End Sub

Private Sub Form_Load()
	SetLink WaveIn.Object, WaveOut.Object
End Sub
	
Note (VB) Please note that you should pass .Object component property in VB 6.0 and .GetOcx property in VB .NET to SetLink procedure. This is true only if you place component on form in design-time. If you create components in runtime than you should pass the component itself:
Dim WaveIn As VCProX.vcproxWaveInDeviceX
Dim WaveOut As VCProX.vcproxWaveOutDeviceX
Set WaveIn = CreateObject("VCProX.vcproxWaveInDeviceX")
Set WaveOut = CreateObject("VCProX.vcproxWaveOutDeviceX")
SetLink WaveIn, WaveOut
		
VC++ If you import VCX to project using C++ #import directive (refer to Adding library to the project section for details) you should use the next code:
void SetLink(IvcproProviderPtr provider,
	IvcproConsumerPtr consumer)
{
	provider->AddConsumer(consumer);
}
	


See also...

Adding library to the project


VCX Library 3.0
Copyright © 2002-2008 Lake of Soft, Ltd
All rights reserved.