MCS260
CORNERSTONE 260 MONOCHROMATORS
66
18.4 C++ USERS
Oriel_USB.h file provides a COriel_USB class that links DLL functions to connect and control the
Cornerstone.
Reminder: Verify the DLL is in the same folder or in command path of executable before running.
Summary:
Add Oriel_USB.h, Cornerstone.dll and CyUSB.dll to project
Add Oriel_USB.h to #include in header file of project.
Create class object with “COriel_USB myDevice;”
Call functions in DLL such as write: “myDevice.Send(strCommand);”
Functions Defined in class:
char * GetLibraryVersion(void);
INT32 Send(const char* strCommand);
INT32 Read(LPSTR strReturn);
INT32 Query(const char* strCommand, char* strReturn);
Sample Query code:
void OnBtnQuery()
{
CString strCommand;
CString strCommunication;
char strPass[256];
char strReturn[1024];
// Command to send
GetDlgItemTextW(cntlCommand, strCommand);
strcpy_s(strPass, CStringA(strCommand).GetString());
strcpy_s(strReturn, "");
LPSTR pstrReturn = strReturn; // Response variable
// Query instrument
INT32 bSuccess = myDevice.Query(strPass, pstrReturn);
if (bSuccess)
{
strCommunication.Append(CString(strReturn));
}
else
{
strCommunication.Append(L"Attempting Read... Failed");
}
History.SetWindowTextW(strCommunication);
}