Wide Studio Object Reference

Wide Studio Home
Up to

## Class Name

WSDmessage

## Specification of methods

### getNewInstance Function Description

Form
  WSDmessage* getNewInstance()
Function
  Create new message class instance
Description
  Message instance can set one message identification string and message receiving function. Messages are posted by specifying a message ID by the sendMessageEx
Parameters
  None.
Return value
  A pointer to a message instance
Notice
Samples

      //Receive a message
      void message_proc(char* data,void* ptr){
        printf("receive data=%s\n",data);
      }
      //Setup for receiving messages
      WSDmessage* message = NULL;
      void init_proc(){
        message = WSDmessage::getNewInstance();
        message->setupMessage("message1",message_proc,NULL);
      }

      //Send a message
      void send_proc(char* send_data){
        WSDmessage::sendMessageEx(NULL,"message1",send_data);
      }

### setupMessage Function Description

Form
  void setupMessage(char* index,void(*proc)(char*,void*),void*)
Function
  Set a message ID and a message handler
Description
  When a message is sent with a specified message ID, this message instance receives the message and executes the message handler.
Parameters

  (in)char* index | Message identification string
  (in)void (*proc)(char*,void*) | Message handler function

Return value
  None.
Notice
  Only one message ID string can be set for each one message instance. When setupMessage( ) is invoked more than twice, last setupMessage( ) setting is effective.
Samples
  Refer to getNewInstance()

  ### sendMessageEx Function Description

  Form
    int sendMessageEx(char* disp,char* index,char* data)
  Function
    Send a message with a specified message identification string
  Description
    On an X11 Window System, disp parameter is the name of the display name When there is no need to set, it can be NULL. Also, in Windows, the parameter is ignored. Send strings starting with data using a message ID string.
  Parameters

    (in)char* disp | Display name
    (in)char* message | Message ID string
    (in)char* data | String data to be sent

  Return value
  Notice
  Samples
    Refer to getNewInstance()

  Document Release 3.70
  For use with Wide Studio Release 3.70, Spring 2004

  Wide Studio Home | Up to

  Copyright(C) WideStudio Development Team, 1999-2004 |  | Last modified: May 25, 2004