home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / windows / winterm / miscell.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-21  |  1.8 KB  |  80 lines

  1. /* miscell.c */
  2.  
  3. #include "windows.h"
  4. #include "info.h"
  5. #include "miscell.h"
  6. #include "term.h"
  7. #include "asdriver.h"
  8. #include "xydriver.h"
  9. #include "term_io.h"
  10.  
  11. extern HWND hMainWnd;
  12. extern HWND hInfoWnd;
  13.  
  14. char *strrchr(char *,char);
  15.  
  16. static char *StripFN(char *Ptr)
  17. {char *P;
  18.  P = strrchr(Ptr,'\\');
  19.  if(P==NULL) return Ptr;
  20.  else return (P+1);
  21. } /* end StripFN */
  22.  
  23. void CommonAS(char *FileName)
  24. {/* common asDriver startup code */
  25.  char *Ptr;
  26.  ascDriver();
  27.  ascDriver();
  28.  /* initialize info window status */
  29.  Ptr = StripFN(FileName);
  30.  InfoChoose('A');
  31.  InfoFileName(Ptr);
  32.  InfoFileSize( ascGetFileLength() );
  33.  InfoErrors(0);
  34.  InfoStatus("Running");
  35.  EnableBreakButton();
  36.  /* pop up info window */
  37.  ShowWindow(hInfoWnd,SW_SHOW);
  38.  SendMessage(hInfoWnd,WM_USER,0,0L);
  39.  /* allow 55 ms for incoming char */
  40.  SetCharWait(55);
  41. }
  42.  
  43. void CommonXY(char *FileName,int *LastPacket,int *LastNAKcount)
  44. {/* common xyDriver startup code */
  45.  char *Ptr;
  46.  xyDriver();
  47.  xyDriver();
  48.  *LastPacket = -1;
  49.  *LastNAKcount = 0;
  50.  /* initialize info window status */
  51.  Ptr = StripFN(FileName);
  52.  InfoChoose('X');
  53.  InfoFileName(Ptr);
  54.  InfoFileSize( xyGetFileLength() );
  55.  InfoPacket(0);
  56.  InfoErrors(0);
  57.  InfoStatus("Running");
  58.  EnableBreakButton();
  59.  /* pop up info window */
  60.  ShowWindow(hInfoWnd,SW_SHOW);
  61.  SendMessage(hInfoWnd,WM_USER,0,0L);
  62.  /* allow 55 ms for incoming char */
  63.  SetCharWait(55);
  64. }
  65.  
  66. void EnableBreakButton(void)
  67. {HMENU hMenu;
  68.  /* enable BREAK button */
  69.  hMenu = GetMenu(hMainWnd);
  70.  EnableMenuItem(hMenu,MSG_BREAK,MF_BYCOMMAND|MF_ENABLED);
  71.  DrawMenuBar(hMainWnd);
  72. }
  73.  
  74. void DisableBreakButton(void)
  75. {HMENU hMenu;
  76.  /* grey the BREAK button */
  77.  hMenu = GetMenu(hMainWnd);
  78.  EnableMenuItem(hMenu,MSG_BREAK,MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
  79.  DrawMenuBar(hMainWnd);
  80. }