Hi JMA,
Below you will find the GPI-DLL code to set the 7 new channel properties which shipped with DIAdem 8.1:
FILE "AdditionalChannelVars.h"
// To set the 7 new (Jan.2002) channel variables:
// - ChnSourceType name of file filter GPI driver
// - ChnParentName plain file name without extension
// - ChnFileName plain file name with extension
// - ChnFilePath path (drive + directory) without file name
// - ChnInstanceKey index of the channel
// - ChnSourceHandle 0
// - ChnSourceName "" (empty string)
//
//
void SetAdditionalChannelVars (long hChannel, long kan);
// hChannel is the channel handle (integer)
// kan is a channel number to go into variable ChnInstanceKey
FILE "AdditionalChannelVars.cpp":
// To set the 7 new (Jan.2002) channel variables:
#include "gpitype.h" // General macros and types of the DLL user interface
#include "datatype.h" // DATA user interface special types and defines
#include "datafct.h" // DATA user interface prototypes
#include "gpifct.h" //
#include "AdditionalChannelVars.h"
#include "afxpriv.h" // for USES_CONVERSION and A2W
extern CString sgDataPathName; //comes from function "fLoad"
void SetAdditionalChannelVars (long hChannel, long kan)
{
long nnn; // to set 7 new channel variables
char szDrv[_MAX_DRIVE];
char szDir[_MAX_DIR];
char szNam[_MAX_FNAME];
char szExt[_MAX_EXT];
char szNamExt[_MAX_FNAME+_MAX_EXT];
char szDrvDir[_MAX_DRIVE+_MAX_DIR];
_splitpath(sgDataPathName,szDrv,szDir,szNam,szExt);
strcpy(szNamExt,szNam); //name
nnn=strlen(szNamExt); //extension
strcpy(&szNamExt[nnn],szExt); //name + extension
strcpy(szDrvDir,szDrv); //drive
nnn=strlen(szDrvDir); //directory
strcpy(&szDrvDir[nnn],szDir); //drive + directory
char szFileDriver[256];
strcpy(szFileDriver,"GPIFileDriver");
nnn = nDIAdemVarGet(szFileDriver,256);
char szInstKey [8];
char szSourceHandle [8];
char szSourceName [8];
sprintf (szInstKey,"%ld\0",kan);
strcpy (szSourceHandle,"0");
szSourceName[0]=0;
//Variables shall be set below by:
USES_CONVERSION;
nnn=lDataProperties(eDataObjParentNameSet,hChannel,0,A2W(szNam));
nnn=lDataProperties(eDataObjFileNameSet,hChannel,0,A2W(szNamExt));
nnn=lDataProperties(eDataObjFilePathSet,hChannel,0,A2W(szDrvDir));
nnn=lDataProperties(eDataObjSrcTypeSet,hChannel,0,A2W(szFileDriver));
nnn=lDataProperties(eDataObjInstanceKeySet,hChannel,0,A2W(szInstKey));
nnn=lDataProperties(eDataObjSrcHandleSet,hChannel,0,A2W(szSourceHandle));
nnn=lDataProperties(eDataObjSrcNameSet,hChannel,0,A2W(szSourceName));
}
Hope it helps,
Brad Turpin
NI