|
Contents | Previous | Next | Subchapters |
winmain.c omdde.c dderror.c omdde.h
int OMServerCmd(char *cmd)
OMServerCmd is TRUE, the server accepted the command.
If the return value
of OMServerCmd is FALSE,
the server is currently busy and cannot execute the clients command.
# include <stdio.h>
# include "define\omdde.h"
extern void AddText(char *add);
int OMServerCmd(char *cmd)
{ AddText("OMServerCmd: Execution is requested for the command\n");
AddText(cmd);
return TRUE;
}
int OMServerInput(enum type_mat mtype, int nr, int nc, void *data)
{ return FALSE;
}
void OMServerOutput(enum type_mat *mtype, int *nr, int *nc, void *data)
{ *mtype = UNDEF_mat;
*nr = 1;
*nc = 1;
return;
}
void Setup()
{
int ok;
AddText("Demo OMServerCmd\n");
ok = OMDdeInitialize();
if( ! ok )
{ AddText("Cannot initialize OMDDE\n");
return;
}
ok = OMServerRegister("C-Server");
if( ! ok )
{ AddText("Cannot register server\n");
OMDdeUninitialize();
return;
}
}
void ShutDown()
{
OMDdeUninitialize();
return;
}
If you have the Microsoft Visual C++ compiler, you can compile
and link this example by executing the command
nmake /f windows.mak omsercmd.exe
in the directory c:\omwin\omdde.
If you then execute the command
omsercmd
then run a copy of O-Matrix,
and at the O> prompt you enter
omlink("client", "C-server")
O-Matrix will respond
T
If you continue by entering
omlink("command", "x = y + z")
O-Matrix will respond
T
and the server will respond
OMServerCmd: Execution is requested for the command
x = y + x