Endif - Agilent Technologies PNA Series User And Programming Manual

Network analyzer
Hide thumbs Also See for PNA Series:
Table of Contents

Advertisement

C++ Example
The following example uses the smart pointer created by Microsoft Visual Studio. The calls to CoInitialize and
CoUninitialize open and close the COM libraries.
Also notice that the pointers local to the main routine are explicitly released. When smart pointers go out of scope,
they will perform this duty implicitly. However, we are calling CoUninitialize before they have the chance to be
destroyed, so we are obliged to release them.
// An example program to illustrate the use of #import to bind to the
// PNA type library.
//
#ifndef _UNICODE
#define _UNICODE

#endif

#include "stdafx.h"
#include "stdio.h"
#include "math.h"
/////////////////////////////////////////////
// import the network analyzer type library
/////////////////////////////////////////////
#import "C:/Program Files/Common Files/Agilent/Pna/835x.tlb" no_namespace,
named_guids
/////////////////////////////////////////////
// include the error definitions for the PNA so we can implement
// error handling.
/////////////////////////////////////////////
#include "C:/Program Files/Common Files/Agilent/Pna/errorsystemmessage.h"
IApplicationPtr pNA; // top level application pointer
float fScalarData [1601]; // global buffer for data retrieval
float fScalarData2[1601];
DWORD dwCookie;
/////////////////////////////////////////////
// SetupChannel:
//
// input: pointer to the channel
//
// function: sets properties on the channel
/////////////////////////////////////////////
void SetupChannel(IChannelPtr pChannel)
{
pChannel->put_StartFrequency( 1.2E9 );
pChannel->put_StopFrequency ( 4.2E9 );
pChannel->put_NumberOfPoints ( 201);
2186

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents