WSPutMessageWithArg (C Function)

int WSPutMessageWithArg(WSLINK link,int msg,int arg)

sends the message msg and its argument arg to the link object link.

Details

  • WSTP messages provide out-of-band message sending and receiving that is not tied to the normal transfer of data.
  • WSPutMessageWithArg() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use WSError() to retrieve the error code if WSPutMessageWithArg() fails.
  • WSPutMessageWithArg() is declared in the WSTP header file wstp.h.

Examples

Basic Examples  (1)

#include "wstp.h"


/* define some custom messages and arguments */

#define AppMenuMessage WSFirstUserMessage + 1

#define AppMenuOption1 1
#define AppMenuOption2 2

/* send an AppMenuMessage to a link */

void f(WSLINK lp)
{
    if(! WSPutMessageWithArg(lp, AppMenuMessage, AppMenuOption2))
        { /* unable to send the message to lp */ }
}