//+++++++++++++++++++++++++++++++
// +++++ DDEterm for MATLAB 16bit
#include <windows.h>
#include <ddeml.h>
#define DLLMEX
extern "C"
{
# include "..\header\mex.h"
# include "..\header\testargs.h"
}
#pragma hdrstop
#define ARGS_IN_MIN 1 //Mindestanzahl Argumente
#define ARGS_IN_MAX 1 //maximal Anzahl Argumente
#define ARG1_IN prhs[0] //DDE Channel
#define ARG1_OUT plhs[0] //return code
extern "C" void mexFunction(int nlhs,Matrix *plhs[],int nrhs,Matrix *prhs[]) {
DWORD hChannel[2]; //2 mal 32 bit
double Result=0;
if (TestIOArgs(nrhs,ARGS_IN_MIN,ARGS_IN_MAX) //alle erforderlichen Parameter angegeben?
&& TestChannelArg(ARG1_IN)) {
hmemcpy((char*)hChannel,(char huge*)mxGetPr(ARG1_IN),sizeof(double));
if (DdeDisconnect(hChannel[0])) { //= Conversation-Handle
hmemcpy((char huge*)mxGetPr(ARG1_IN),(char*)&Result,sizeof(double)); //Channel-Handle zuruecksetzen
Result = (double) 1;
}
}
ARG1_OUT=mxCreateFull(1,1,REAL);
hmemcpy( (char huge*)mxGetPr(ARG1_OUT), (char*)&Result, sizeof(double) );
}
Detected encoding: ASCII (7 bit) | 2
|