home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 15 / CDACTUAL15.iso / cdactual / program / c / WINKERM.ZIP / KERMMISC.C < prev    next >
Encoding:
C/C++ Source or Header  |  1989-05-13  |  3.0 KB  |  103 lines

  1. /*******************************************************************************
  2. **                                                                            **
  3. **                      Kermit for Microsoft Windows                          **
  4. **                      ----------------------------                          **
  5. **                               KERMMISC.C                                   **
  6. **                                                                            **
  7. **  This module contains miscellaneous routines for the applications.         **
  8. **                                                                            **
  9. *******************************************************************************/
  10.  
  11. // INCLUDES -------------------------------------------------------------------
  12.  
  13. #include "kermit.h"
  14.  
  15. //-----------------------------------------------------------------------------
  16. int GoDialogBox(HANDLE hInstance, LPSTR lpTemplateName,
  17.                 HWND hWndParent, FARPROC lpProc)
  18.  
  19. //  Description of what function does.
  20.  
  21. //  Param(s):   x...............Description.
  22.  
  23. //  Returns:    Result description.
  24.  
  25. {
  26.     int     nResult;
  27.     FARPROC lpDialog;
  28.  
  29.     lpDialog = MakeProcInstance(lpProc, hInstance);
  30.     nResult = DialogBox(hInstance, lpTemplateName, hWndParent, lpDialog);
  31.     FreeProcInstance(lpDialog);
  32.  
  33.     return(nResult);
  34. }
  35.  
  36. //-----------------------------------------------------------------------------
  37. VOID EnableCommCommands(WORD wEnable)
  38.  
  39. //  Description of what function does.
  40.  
  41. //  Param(s):   x...............Description.
  42.  
  43. //  Returns:    Result description.
  44.  
  45. {
  46.     EnableMenuItem(hAppMenu, IDM_BREAK,wEnable);
  47. }
  48.  
  49. //-----------------------------------------------------------------------------
  50. VOID EnableConfigCommands(WORD wEnable)
  51.  
  52. //  Description of what function does.
  53.  
  54. //  Param(s):   x...............Description.
  55.  
  56. //  Returns:    Result description.
  57.  
  58. {
  59.     EnableMenuItem(hAppMenu, 4, wEnable | MF_BYPOSITION);
  60.     DrawMenuBar(hAppWnd);
  61. }
  62.  
  63. //-----------------------------------------------------------------------------
  64. VOID SetKermitCommands(LPSTR lpMenuName, WORD wEnable)
  65.  
  66. //  Description of what function does.
  67.  
  68. //  Param(s):   x...............Description.
  69.  
  70. //  Returns:    Result description.
  71.  
  72. {
  73.     WORD  wMenuSize, i;
  74.     HMENU hSubMenu;
  75.  
  76.     ChangeMenu(hAppMenu, 3, "&Kermit", LoadMenu(hAppInst, lpMenuName),
  77.                MF_POPUP | MF_CHANGE | MF_BYPOSITION);
  78.  
  79.     EnableMenuItem(hAppMenu, 3, wEnable | MF_BYPOSITION);
  80.     DrawMenuBar(hAppWnd);
  81. }
  82.  
  83. //-----------------------------------------------------------------------------
  84. int KermitFmtMsgBox(WORD wType, PSTR pszFmt, ...)
  85.  
  86. //  Description of what function does.
  87.  
  88. //  Param(s):   x...............Description.
  89.  
  90. //  Returns:    Result description.
  91.  
  92. {
  93.     char        sWork[128];
  94.     va_list     pArg;
  95.     int         nLen;
  96.  
  97.     va_start(pArg, pszFmt);
  98.     nLen = vsprintf(sWork, pszFmt, pArg);
  99.     va_end(pArg);
  100.  
  101.     return(MessageBox(hAppWnd, sWork, szAppName, wType));
  102. }
  103.