home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / d / d009_2 / 1.ddi / SAMPLES / DOCS / TESTDLGS.MS$ / TESTDLGS.bin
Encoding:
Text File  |  1992-02-03  |  2.4 KB  |  83 lines

  1. '*********************** TESTDLGS.MST ************************************
  2. 'Demonstrates:  The use of procedures found in the TESTDLGS.DLL Library,
  3. '               provided with Microsoft test for Windows.
  4. '
  5. 'Required Files: MSTEST.INC, TESTDLGS.DLL
  6. '
  7. 'Uses: TESTDLGS
  8. '
  9. 'Complexity Level: INTERMEDIATE
  10. '
  11. 'Notes:
  12. '
  13. '*************************************************************************
  14.  
  15. '$DEFINE TESTDLGS
  16. '$INCLUDE 'MSTEST.INC'
  17.  
  18. DIM ret%, WinHandle%
  19.  
  20. Viewport Clear
  21.  
  22. '*** Dlgs.cmp will be where dialog information is saved
  23. '*** Dlgs.res will be where comparison results are logged
  24.  
  25. ret = SetDialogFile("dlgs.cmp")
  26. ret = SetLogFile("dlgs.res")
  27.  
  28. RUN "calc.exe", NOWAIT
  29.  
  30. WinHandle = WGetActWnd(0)  '*** Get the handle of the active application
  31.  
  32. DoKeys "%vs"   '*** Send Alt+v+s to ensure calc is in scientific mode
  33.  
  34. '*** Save the scientific calculator menu structure and attributes
  35. '*** as dialog number 1 in dlgs.cmp:
  36. ret = SaveMenu(Winhandle, 1, "ScientificMenu", TRUE)
  37.  
  38. '*** Save the standard calculator menu structure and attributes, this
  39. '*** time as dialog number 2 in dlgs.cmp:
  40.  
  41. ret = SaveMenuActivate("%vt", "", 2, "StandardMenu",TRUE)
  42.  
  43. '*** Select the Help/About Calculator menu item, record its controls in a
  44. '*** dialog record number 3, then close the About box.
  45.  
  46. ret = SaveWindowActivate("%ha", "{ENTER}", 3, "AboutBoxControls",TRUE, FALSE)
  47.  
  48. '*** Compare the active window (calc in standard mode) to dialog number 1:
  49.  
  50. ret = CmpWindow(Winhandle, 1, TRUE)
  51.  
  52. SELECT CASE ret
  53.     CASE 0
  54.         PRINT "Return Value =  "; ret; "Window controls compared exactly"
  55.     CASE -1
  56.         PRINT "Return Value =  "; ret; "Windows compared, but were fuzzy"
  57.     CASE -3
  58.         PRINT "Return Value =  "; ret; "Control not found"
  59.     CASE ELSE
  60.         PRINT "Return Value =  "; ret; "Return value not in SELECT-CASE block"
  61. END SELECT
  62.  
  63. '*** Compare the active window to dialog number 2. This should result in
  64. '*** an exact match:
  65.  
  66. ret = CmpWindow(WinHandle, 2, TRUE)
  67.  
  68. SELECT CASE ret
  69.     CASE 0
  70.         PRINT "Return Value =  "; ret; "Window controls compared exactly"
  71.     CASE -1
  72.         PRINT "Return Value =  "; ret; "Windows compared, but were fuzzy"
  73.     CASE -3
  74.         PRINT "Return Value =  "; ret; "Control not found"
  75.     CASE ELSE
  76.         PRINT "Return Value =  "; ret; "Return value not in SELECT-CASE block"
  77. END SELECT
  78.  
  79. DoKeys "%{F4}"  '*** Send Alt+F4 to exit calculator
  80.  
  81. END
  82.  
  83.