This example shows how the substitution process works when the WinSubstituteStrings call is made.

#define INCL_WINDIALOGS
#include <OS2.H>

static MRESULT ClientWindowProc(HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2);
test()
{
  HWND hwnd;
  char source[] = "This is the source string: %1";
  char result[22];
  MPARAM mp1;
  ULONG  msg;

  /* This function performs a substitution process on a text string, */
  /* replacing specific marker characters with text supplied         */
  /* by the application.                                             */
  WinSubstituteStrings(hwnd,
                       source,
                       sizeof(result),
                       result);

  /* WM_SUBSTITUTESTRING message is sent to the window  */
  /* defined by hwnd.                                         */
}
static MRESULT ClientWindowProc( HWND hwnd, ULONG  msg, MPARAM mp1, MPARAM mp2 )
{
  switch(msg)
  {
    case WM_SUBSTITUTESTRING:
    switch( (ULONG)mp1)
    {
      case 1:
      return(MRFROMP("A"));
      break;
    }
    break;
  }
}


[Back] [Next]