|
Contents | Previous | Next | Subchapters |
char *OMClientPutCmd(int id, char *cmd)
"ok", the commands were accepted by the server for execution.
If the return value is equal to "busy",
the server is currently busy and will not accept the commands.
Any other return value is an error message.
Hello World
in the command window of a currently running copy of O-Matrix.
It is in the file omclicmd.c
in the directory omwin\omdde.
If you have the Microsoft Visual C++ compiler,
it can be compiled and linked by executing the command
nmake /f console.mak omclicmd.exe
in that directory.
# include <stdio.h>
# include "define\omdde.h"
# include "define\noserver.h"
int main()
{
int id;
int ok;
char *msg;
char *cmd = "print \"Hello World\"";
ok = OMDdeInitialize();
if( ! ok )
{ printf("Cannot initialize OMDDE\n");
return 1;
}
id = OMClientConnect("O-Matrix");
if( id == OMDDE_CONNECTION_FAILED )
{ printf("Cannot connect to O-Matrix\n");
return 1;
}
msg = OMClientPutCmd(id, cmd);
if( strcmp(msg, "ok") != 0 )
{ printf("Command transfer failed: %s\n", msg);
return 1;
}
OMDdeUninitialize();
return 0;
}
OMClientConnect.