home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / PROG_C / CENVIW9.ZIP / KEYGHOST.CMM < prev    next >
Text File  |  1994-03-08  |  2KB  |  56 lines

  1. //**************************************************************************
  2. //*** KeyGhost.cmm - Example for how to control other programs using the ***
  3. //*** ver.1          the keyboard stuffing routines in KeyPush.Lib.      ***
  4. //**************************************************************************
  5.  
  6. #include <Message.lib>
  7. #include <KeyPush.lib>
  8. #include <MsgBox.lib>
  9.  
  10. // Start NotePad running
  11.    if ( -1 == spawn(P_NOWAIT,"NotePad.exe") ) {
  12.       MessageBox("ERROR: Unable to execute NotePad.exe.");
  13.       exit(1);
  14.    }
  15.  
  16. // Enter initial CEnvi sentence
  17.    SpeedKeys("CEnvi is good.");
  18.  
  19. // Change "good" to "great"
  20.    for ( i = 0; i < 5; i++ )
  21.       KeyStroke(VK_SHIFT,VK_LEFT)
  22.    SpeedKeys("great!");
  23.  
  24. // Figure out how much it costs per day for a year
  25.    SpeedKeys("\n\nIs it worth 38 dollars?\n"
  26.              "To use it every day for a year costs");
  27. // Bring up calculator to figure $38.00 / 365 * 10
  28.    if ( -1 == spawn(P_NOWAIT,"Calc.exe") ) {
  29.       MessageBox("ERROR: Unable to execute Calc.exe.");
  30.       exit(1);
  31.    }
  32.    SpeedKeys("C38.00/365=*100=",300);// perform calculation
  33.    KeyStroke(VK_ALT,"EC");           // copy result into the clipboard
  34.    KeyStroke(VK_ALT,VK_F4);          // Exit the calculator
  35.  
  36. // Paste the result into NotePad then continue senctence
  37.    KeyStroke(VK_ALT,"EP");
  38.    SpeedKeys(" pennies a day.\nWhat a bargain!");
  39.  
  40. // now print the message to register
  41.    SpeedKeys("\n\nRegister now!");
  42. // copy the Register message just printed and print it many more times
  43.    KeyStroke(VK_SHIFT,VK_HOME);
  44.    KeyStroke(VK_SHIFT,VK_UP);
  45.    KeyStroke(VK_CONTROL,VK_INSERT);
  46.    KeyStroke(VK_DOWN), KeyStroke(VK_END);
  47. // print that message another 15 times
  48.    for ( i = 0; i < 7; i++ )
  49.       KeyStroke(VK_SHIFT,VK_INSERT);
  50.  
  51.  
  52. // finally, say goodbye and exit
  53.    SpeedKeys("\nThank you.");
  54.    KeyStroke(VK_ALT,"FX");
  55.    KeyStroke('N');
  56.