home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c070 / 4.ddi / TOOLS.4 / TCTSRC1.EXE / HLDISP.C < prev    next >
Encoding:
C/C++ Source or Header  |  1989-03-31  |  3.1 KB  |  104 lines

  1. /**
  2. *
  3. * Name        HLDISP -- Display help in a virtual window and read
  4. *              user responses.
  5. *
  6. * Synopsis    presult = hldisp (pdatabase_path, pid_string, offset,
  7. *                  pfinal, option);
  8. *
  9. *        WN_EVENT *presult    pfinal, or NIL if an error
  10. *                    occurred.
  11. *        const char        The name of the help database to
  12. *            *pdatabase_path    search.
  13. *        const char *pid_string    The help ID string to search
  14. *                    for.
  15. *        unsigned long offset    If pid_string is NIL or points
  16. *                    to the NUL string ("\0"), this
  17. *                    is the absolute offset of the
  18. *                    help record in the help
  19. *                    database.
  20. *        WN_EVENT *pfinal    Pointer to structure to fill in
  21. *                    with a copy of the event which
  22. *                    terminated the read.
  23. *        int option        Bitwise ORing of the following:
  24. *                    HL_USE_MOUSE: Use the mouse if
  25. *                      it is present.
  26. *                    HL_NO_MOUSE: Do not use the
  27. *                      mouse.
  28. *                    HL_KBIGNORE: Ignore the keyboard
  29. *                      and discard all keystrokes.
  30. *
  31. *
  32. * Description    This function will read the help text for the specified
  33. *        help record from the specified help database, display it
  34. *        and read responses from it until the user hits ESC or
  35. *        Enter.    The option argument can be used to ignore the
  36. *        mouse if it is present.
  37. *
  38. *        The help window's characteristics (i.e., viewport size,
  39. *        attributes, etc.) are taken from the help database
  40. *        record.
  41. *
  42. *        An error occurs if the database does not exist or if
  43. *        the specified help record is not in the database.
  44. *
  45. *        The return value is a pointer to an internal static copy
  46. *        of the event node which terminated the read; this copy
  47. *        will be overwritten with each call to HLREAD.
  48. *
  49. * Returns    pfinal          Pointer to event node which terminated
  50. *                  the read process (the event's action
  51. *                  will be either WN_TRANSMIT or
  52. *                  WN_ABORT), or NIL if error.
  53. *        b_pcurwin      NIL.
  54. *        b_wnerr       Possible values:
  55. *                  (No change)       Success.
  56. *                  WN_BAD_DEV       Unknown device or
  57. *                            window dimensions
  58. *                            overflow screen.
  59. *                  WN_ILL_DIM       Viewport is larger
  60. *                            than data area, or
  61. *                            origin is illegal.
  62. *                  WN_NO_MEMORY       Insufficient memory.
  63. *                  WN_BAD_WIN       Internal error.
  64. *                  WN_ALREADY_SHOWN Internal error.
  65. *                  WN_BAD_NODE       Internal error.
  66. *                  WN_BAD_PAGE       Internal error.
  67. *                  WN_COVERED       Internal error.
  68. *                  WN_NOT_SHOWN       Internal error.
  69. *                  WN_NULL_PTR       Internal error.
  70. *
  71. * Version    6.00 (C)Copyright Blaise Computing Inc.  1989
  72. *
  73. **/
  74.  
  75. #include <bhelp.h>
  76.  
  77.  
  78. WN_EVENT *hldisp(pdatabase_path, pid_string, offset, pfinal,
  79.          option)
  80. const char     *pdatabase_path;
  81. const char     *pid_string;
  82. unsigned long    offset;
  83. WN_EVENT       *pfinal;
  84. int        option;
  85. {
  86.     HL_WINDOW  help_window;
  87.     char      *phelp_text;
  88.     int        text_length;
  89.     WN_EVENT  *presult;
  90.     int        error;
  91.  
  92.     error = hllookup(pdatabase_path, pid_string, offset, &help_window,
  93.              &phelp_text, &text_length, HL_COMPRESSED);
  94.     if (error != HL_NO_ERROR)
  95.     return(NIL);
  96.  
  97.     presult = hlread(NIL, &help_window, phelp_text, text_length,
  98.              pfinal, HL_COMPRESSED | (option & ~HL_TEXT_TYPE));
  99.  
  100.     free(phelp_text);
  101.  
  102.     return(presult);
  103. }
  104.