menu.c
上传用户:xiaoan1112
上传日期:2013-04-11
资源大小:19621k
文件大小:7k
源码类别:

操作系统开发

开发平台:

Visual C++

  1. /*********************************************************************
  2.  * Microsoft Diagnostics Version 2.0
  3.  *
  4.  * A diagnostic utility to detect as much useful information about a
  5.  *   customer's computer system as is possible.
  6.  *
  7.  * Microsoft Diagnostics:  We detect the World.
  8.  *
  9.  * SHOWINFO.C - Source file for displaying information
  10.  ********************************************************************/
  11. /* Include Files */
  12. #include "msd.h"
  13. #ifdef CW_INCLUDED
  14. /********
  15. // the rgmpvkeyid is a list of accelerators 
  16. // don't use F1 -- reserved for HELP 
  17. // list must end with a 0,0 entry
  18. MPVKEYID rgmpvkeyid[]=
  19.   {
  20.   {0, 0},
  21.   {VK_F2,         midNew},
  22.   {VK_F3,         midOpen},
  23.   {VK_F4,         midSave},
  24.   {'C'-'@' | KK_CONTROL,  midColorChange1},
  25.   {VK_F5,         midQuit},
  26.   {VK_F7 | KK_ALT,    midOverlapMove},
  27.   {VK_F7 | KK_SHIFT,    midOverlapSize},
  28.   {VK_F7,         midOverlapPop},
  29.   {'B'-'@' | KK_CONTROL,  midTimeBltRrc},
  30.   {'F'-'@' | KK_CONTROL,  midTimeFillArc},
  31.   {'T'-'@' | KK_CONTROL,  midTimeTextOut},
  32.   {VK_F10,        midMode},
  33.   {'L'-'@' | KK_CONTROL,  midColorLoad},
  34.   {'S'-'@' | KK_CONTROL,  midColorSave},
  35.   {VK_F2 | KK_SHIFT,    midOtherFlush},
  36.   {'Q',         midQuit},
  37.   {0,0}
  38.   };
  39. MPVKEYID *prgmpvkeyid = &rgmpvkeyid[0];
  40. ********/
  41. //  -- respond to a menu command (i.e. WM_COMMAND)
  42. VOID
  43. MenuCommand(pwnd, mid)
  44. PWND pwnd;
  45. WORD mid;
  46. {
  47.   Unreferenced(pwnd);
  48.   switch (mid)
  49.     {
  50.       case midFind:
  51.         {
  52.           WORD wReturnValue;  /* Return value from DialogBox */
  53.           QSZ * pqszStrings;  /* String array                */
  54.           wReturnValue = DialogBox (&dlgFindFile1, FindFileDlg1);
  55.           if (wReturnValue == IDD_USER + 11 ||
  56.               wReturnValue == IDOK)
  57.             {
  58.               BYTE * pVer = NULL;   /* Version information */
  59.               /* Get the version information */
  60.               pVer = GetFileVersion (pszBrowseTitle, FALSE);
  61.               if (pVer == NULL && wReturnValue != IDOK)
  62.                 {
  63.                   MessageBox ("Version information for",
  64.                               pszBrowseTitle,
  65.                               "is not available",
  66.                               MB_OK | 0x8000);
  67.                   break;
  68.                 }
  69.               if (pVer != NULL)
  70.                 {
  71.                   /* Put the version information into strings */
  72.                   pqszStrings = SprintFileVersion (pVer);
  73.                   if (pqszStrings == NULL)
  74.                     break;
  75.                   /* Display the version information */
  76.                   CreateInfoWnd (pszBrowseTitle, pqszStrings, TRUE);
  77.                   wReturnValue = IDD_USER + 11;
  78.                 }
  79.             }
  80.           if (wReturnValue == IDD_USER + 10 ||
  81.               wReturnValue == IDOK)
  82.             {
  83.               /* Read the file */
  84.               pqszStrings = ViewFile (pszBrowseTitle, FALSE);
  85.               if (pqszStrings       != NULL &&
  86.                   pqszStrings[0]    != NULL &&
  87.                   pqszStrings[0][0] != '')
  88.                 {
  89.                   /* Display the strings in an Info Window */
  90.                   CreateInfoWnd (pszBrowseTitle, pqszStrings, TRUE);
  91.                 }
  92.             }
  93.           break;
  94.         }
  95.       case midReport:
  96.         if (DialogBox (&dlgReport, ReportDlg) == IDOK)
  97.           ReportFromCW();
  98.         break;
  99.       case midAutoexecBat:
  100.         FindAndViewFile (rgszSystemFiles[0], rgwSystemFiles[0], FALSE);
  101.         break;
  102.       case midConfigSys:
  103.         FindAndViewFile (rgszSystemFiles[1], rgwSystemFiles[1], FALSE);
  104.         break;
  105.       case midSystemIni:
  106.         FindAndViewFile (rgszSystemFiles[2], rgwSystemFiles[2], FALSE);
  107.         break;
  108.       case midWinIni:
  109.         FindAndViewFile (rgszSystemFiles[3], rgwSystemFiles[3], FALSE);
  110.         break;
  111.       case midMsmailIni:
  112.         FindAndViewFile (rgszSystemFiles[4], rgwSystemFiles[4], FALSE);
  113.         break;
  114.       case midProtocolIni:
  115.         FindAndViewFile (rgszSystemFiles[5], rgwSystemFiles[5], FALSE);
  116.         break;
  117.       case midDblSpaceIni:
  118. FindAndViewFile (rgszSystemFiles[6], rgwSystemFiles[6], FALSE);
  119. break;
  120.       case midMemMakerSts:
  121. FindAndViewFile (rgszSystemFiles[7], rgwSystemFiles[7], FALSE);
  122.         break;
  123.       case midQuit:
  124.         Exit(0);
  125.         break;
  126.       case midBrowser:
  127.         if (DialogBox (&dlgMemoryBrowser, MemoryBrowserDlg) == IDOK)
  128.           {
  129.             if (pqszBrowseStrings       != NULL &&
  130.                 pqszBrowseStrings[0]    != NULL &&
  131.                 pqszBrowseStrings[0][0] != '')
  132.               {
  133.                 /* Display the strings in an Info Window */
  134.                 CreateInfoWnd (pszBrowseTitle, pqszBrowseStrings, TRUE);
  135.               }
  136.             else
  137.               MessageBox ("Search text not found", NULL, NULL, MB_OK | 0x8000);
  138.           }
  139.         break;
  140.       case midBlockDisplay:
  141.         DialogBox (&dlgMemoryBlockDisplay, MemoryBlockDisplayDlg);
  142.         break;
  143.       case midInsert:
  144.         InsertCommand();
  145.         break;
  146.       case midPrtTst:
  147.         if (DialogBox (&dlgTestPrinter, TestPrinterDlg) == IDOK)
  148.           TestPrinter (tpValue.fPostscript,
  149.                        tpValue.f8BitTest,
  150.                        tpValue.fSerialTest,
  151.                        tpValue.wPort);
  152.         break;
  153.       case midBlackWhite:
  154.         SetIsaColors (fBlackWhite = !fBlackWhite);
  155.         break;
  156.       case midAbout:
  157.         DialogBox (&dlgAbout, AboutDlg);
  158.         break;
  159.       default:
  160.         break;
  161.     }
  162. }
  163. /**********
  164. //  -- put in names when they are asked for
  165. CHAR * FAR
  166. SzFromSid(sid)
  167. WORD sid;
  168. {
  169.   static CHAR aszIsa[cchIsaMax+5];
  170.   if (sid >= midIsaList)
  171.     {
  172.       aszIsa[0] = '~';
  173.       strcpy(&aszIsa[1], rgszIsa[sid-midIsaList]);
  174.       return(&aszIsa[0]);
  175.     }
  176.   else
  177.     return ((CHAR *) sid);
  178. }
  179. //  -- Keep running track of the colour change menus as they open
  180. VOID FAR
  181. ColourChange3(mid)
  182. WORD mid;
  183. {
  184.   static ISA isa;
  185.   static WORD coFore;
  186.   static WORD fHilite;
  187.   static WORD coBack;
  188.   static WORD fBlink;
  189.   static WORD midLastColour = midCh3Black;
  190.   static BOOL fForeground = FALSE;
  191.   if (mid >= midIsaList)
  192.     {
  193.       isa = (ISA) (mid - midIsaList);
  194.     }
  195.   else if (mid == midCh3Foreground || mid == midCh3Background)
  196.     {
  197.       fForeground = mid & 1;
  198.       GetColor(isa, &coFore, &fHilite, &coBack, &fBlink);
  199.       CheckMenuItem(midLastColour, FALSE);
  200.       if (fForeground)
  201.         {
  202.           CheckMenuItem(midCh3Hilight, fHilite);
  203.           midLastColour = midCh3Black + coFore;
  204.           CheckMenuItem(midLastColour, TRUE);
  205.         }
  206.       else
  207.         {
  208.           CheckMenuItem(midCh3Hilight, fBlink);
  209.           midLastColour = midCh3Black + coBack;
  210.           CheckMenuItem(midLastColour, TRUE);
  211.         }
  212.     }
  213.   else if (mid == midCh3Hilight)
  214.     {
  215.       if (fForeground)
  216.         {
  217.           SetThisColor(isa, coFore, !fHilite, coBack, fBlink);
  218.         }
  219.       else
  220.         {
  221.           SetThisColor(isa, coFore, fHilite, coBack, !fBlink);
  222.         }
  223.     }
  224.   else if (mid >= midCh3Black)
  225.     {
  226.       if (fForeground)
  227.         {
  228.           SetThisColor(isa, mid-midCh3Black, fHilite, coBack,
  229.             fBlink);
  230.         }
  231.       else
  232.         {
  233.           SetThisColor(isa, coFore, fHilite, mid-midCh3Black,
  234.             fBlink);
  235.         }
  236.     }
  237. }
  238. **********/
  239. #endif /* CW_INCLUDED */