home *** CD-ROM | disk | FTP | other *** search
/ Boston 2 / boston-2.iso / DOS / PROGRAM / C / INST / WPRINTF.H < prev    next >
Text File  |  1993-12-01  |  9KB  |  156 lines

  1. /*----------------------------------------------------------------------------*\
  2. |   wprintf.h - Routines for using debuging windows                   |
  3. |                                                                              |
  4. |   Usage:                                                                     |
  5. |      Call CreateDebugWindow()  to set up a window for debuging messages      |
  6. |      Use  DebugPrintf ()                                                     |
  7. |      or   vDebugPrintf ()      to put messages in to the window              |
  8. |                                                                              |
  9. |   Description:                                                               |
  10. |       This is intended as a starting point for debuging apps quickly.        |
  11. |                                                                              |
  12. |   Notes:                                                                     |
  13. |       "->" means "a pointer to", "->>" means "a handle to"                   |
  14. |                                                                              |
  15. |   History:                                                                   |
  16. |       10/02/86 Todd Laney Created                                            |
  17. |       04/14/87 Added new function CreateDebugWin                             |
  18. |                                                                              |
  19. \*----------------------------------------------------------------------------*/
  20.  
  21. /* NOTE windows.h must be included prior to this file */
  22.  
  23. /*----------------------------------------------------------------------------*\
  24. |                                                                              |
  25. |   f u n c t i o n   d e f i n i t i o n s                                    |
  26. |                                                                              |
  27. \*----------------------------------------------------------------------------*/
  28.  
  29. /*----------------------------------------------------------------------------*\
  30. |  CreatePrintfWindow (hWnd, pcText,bTiled, iMaxLines)                         |
  31. |                                                                              |
  32. |   Description:                                                               |
  33. |     Creates a tiled window for the depositing of debuging messages.          |
  34. |                                                                              |
  35. |   Arguments:                                                                 |
  36. |     hWnd      - Window handle of the parent window.                          |
  37. |     pcText    - String to appear in the caption bar of the debuging window   |
  38. |     bTiled    - FALSE => window is a popup,  Tiled otherwise.                |
  39. |     iMaxLines - The maximum number of text lines to display in the window    |
  40. |                                                                              |
  41. |   Returns:                                                                   |
  42. |     A window handle of the debuging window, or NULL if a error occured.      |
  43. |                                                                              |
  44. \*----------------------------------------------------------------------------*/
  45.  
  46. HWND FAR PASCAL CreatePrintfWindow (HWND,LPSTR,BOOL,int);
  47.  
  48. /*----------------------------------------------------------------------------*\
  49. |  CreatePrintfWin (hParent, lpchName, dwStyle, x, y, dx, dy, iMaxLines)       |
  50. |                                                                              |
  51. |   Description:                                                               |
  52. |     Creates a window for the depositing of debuging messages.                |
  53. |                                                                              |
  54. |   Arguments:                                                                 |
  55. |     hWnd      - Window handle of the parent window.                          |
  56. |     pcName    - String to appear in the caption bar of the debuging window   |
  57. |     dwStyle   - Window style                                                 |
  58. |     x,y       - Location of window                                           |
  59. |     dx,dy     - Size of the window                                           |
  60. |     iMaxLines - The maximum number of text lines to display in the window    |
  61. |                                                                              |
  62. |   Returns:                                                                   |
  63. |     A window handle of the debuging window, or NULL if a error occured.      |
  64. |                                                                              |
  65. \*----------------------------------------------------------------------------*/
  66.  
  67. HWND FAR PASCAL CreatePrintfWin (HWND,HANDLE,LPSTR,DWORD,WORD,WORD,WORD,WORD,int);
  68.  
  69. /*----------------------------------------------------------------------------*\
  70. |   wprintf (hWnd,str,...)                                                     |
  71. |                                                                              |
  72. |   Description:                                                               |
  73. |       Writes data into the window hWnd (hWnd must be created with            |
  74. |       CreateDebugWindow ())                                                  |
  75. |       follows the normal C printf definition.                                |
  76. |                                                                              |
  77. |   Arguments:                                                                 |
  78. |       hWnd            window handle for the Degubing window                  |
  79. |       str             printf control string                                  |
  80. |       ...             extra parameters as required by the contol string      |
  81. |                                                                              |
  82. |   NOTE: if hWnd == NULL text will be printed in the window used in the last  |
  83. |      call to wprintf.                               |
  84. \*----------------------------------------------------------------------------*/
  85.  
  86. int FAR cdecl wprintf  (HWND,LPSTR,...);
  87. int FAR cdecl vwprintf (HWND,LPSTR,LPSTR);
  88.  
  89. /*----------------------------------------------------------------------------*\
  90. |   WinPrintf (str,...)                                |
  91. |                                                                              |
  92. |   Description:                                                               |
  93. |    Writes formated string to either window or com1                |
  94. |       follows the normal C printf definition.                                |
  95. |                                                                              |
  96. |   special string format:                               |
  97. |    %W    - Enable output to window                       |
  98. |    %1    - Enable output to COM1:                       |
  99. |    %M    - Enable output to MsgBox                       |
  100. |    %0    - Turn off output                           |
  101. |                                                                              |
  102. |   Arguments:                                                                 |
  103. |       hWnd            window handle for the Degubing window                  |
  104. |       str             printf control string                                  |
  105. |       ...             extra parameters as required by the contol string      |
  106. |                                                                              |
  107. |   Return Value:                                   |
  108. |    Number of chars output (IDOK/IDCANCEL, for %M)                   |
  109. |                                                                              |
  110. \*----------------------------------------------------------------------------*/
  111. int FAR cdecl WinPrintf(LPSTR,...);
  112. int FAR cdecl vWinPrintf(LPSTR,LPSTR);
  113.  
  114. HFONT FAR PASCAL SetPrintfFont (HWND,HFONT);
  115. void  FAR PASCAL ClearPrintfWnd (HWND);
  116.  
  117. /*----------------------------------------------------------------------------*\
  118. |   vsprintf.c - printf routines for the windows environment                   |
  119. |                                                                              |
  120. |   Description:                                                               |
  121. |                                                                              |
  122. |   Notes:                                                                     |
  123. |                                                                              |
  124. \*----------------------------------------------------------------------------*/
  125.  
  126. int far cdecl fsprintf    (LPSTR, LPSTR, ...);
  127. int far cdecl fvsprintf (LPSTR, LPSTR, LPSTR);
  128.  
  129. /*
  130.  *  WPF_CHARQUE
  131.  *
  132.  *  window style used to get char queing
  133.  */
  134. #define WPF_CHARQUE    0x00000001L
  135.  
  136. /*
  137.  *  WPF_NTEXT
  138.  *
  139.  *  sent to the parent of a printf window when the user enters a string
  140.  *  and presses return.
  141.  *
  142.  *    wParam = windows handle of printf window.
  143.  *    lParam = LPSTR to newly entered text.
  144.  */
  145. #define WPF_NTEXT (WM_USER + 100)
  146.  
  147. /*
  148.  *  WPF_NCHAR
  149.  *
  150.  *  sent to the parent of a printf window when the user types a new char
  151.  *
  152.  *    wParam = windows handle of printf window.
  153.  *    lParam = LOWORD = vir key code of key pressed
  154.  */
  155. #define WPF_NCHAR (WM_USER + 101)
  156.