Microsoft Visual Studio 6, Visual C++

Using ActiveX in MFC AppWizard (exe) Projects

1) From Workspace pane, select ResourceView.

2) In Dialog folder double click dialog where you wish to use ActiveX.

3) Right click on the dialog and choose Insert ActiveX Control...

4) In the Insert ActiveX Control dialog box choose FabulaTech SPC Control Class and click OK.

5) As result FabulaTech SPC Control Class appears on your dialog.

6) Add variable of the control to the class of your dialog. To do it, right-click on the control and choose Class Wizard...

7) Click Member Variables tab, then click Add Variable...

8) Confirm you wish to create wrapper and then specify new variable name, e.g. m_spcControl. Then click OK.

9) Now, we can reference our control using specified name. For example:

BOOL status;
status = m_spcControl.IsEnabled();

Using ActiveX in Win32 Console Application Projects

Use #import preprocessor directive to add ActiveX component to your application.

#include "stdafx.h"
#import "ftspcax.dll"

Compiler will automatically generate all necessary code for working with this component and put it into the namespace with name FabulaTech SPC Control Class.

You can declare object and access methods and properties in the following way:

CoInitialize(NULL);
try
{
	BOOL status;
	FTSPC::IFTSPCControlPtr spcControl(TEXT("FTSPC.FTSPCControl"));
	status = spcControl->IsEnabled();
}
catch(_com_error error)
{
	// ToDo: Handle error
}