Contents Previous Next Subchapters

Disconnecting an OMDDE Client From a Server

Prototype
void OMClientDisconnect(int id)

Description
This call terminates the connection specified by id where id is the integer value returned by a previous call to OMClientConnect .

Example
The following program is in the file omclidis.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 omclidis.exe
in that directory.

# include <stdio.h>
# include "define\omdde.h"
# include "define\noserver.h"

int main()
{
     int id;
     int ok;

     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;
     }
     else printf("Can connect to O-Matrix\n");
     
     OMClientDisconnect(id);
     
     OMDdeUninitialize();
     return 0;
}

Reference
Invalid memory will be accessed if id is not equal to a previous return value of OMClientConnect.