MultiCam Boards Documentation > MultiCam Documentation > MultiCam User Guide > MultiCam Basics > Classes > Code Examples for Objects Management > How to Create and Delete Surfaces

How to Create and Delete Surfaces

The following code shows how to create three MultiCam surfaces. At the end, after application code, the surfaces are deleted. The Status variable can be used for error checking.

[C]

//Connecting to driver

MCSTATUS Status = McOpenDriver(NULL);

//Instantiating a first surface

MCHANDLE MySurface1;
MCSTATUS Status = McCreate(MC_DEFAULT_SURFACE_HANDLE, &MySurface1);

//Instantiating a second surface

MCHANDLE MySurface2;
Status = McCreate(MC_DEFAULT_SURFACE_HANDLE, &MySurface2);

//Instantiating a third surface

MCHANDLE MySurface3;
Status = McCreate(MC_DEFAULT_SURFACE_HANDLE, &MySurface3);

//...
//Application code
//...

//Deleting all surfaces

Status = McDelete(MySurface1);
Status = McDelete(MySurface2);
Status = McDelete(MySurface2);

//Disconnecting from driver

Status = McCloseDriver();