home *** CD-ROM | disk | FTP | other *** search
/ Mega Top 1 / os2_top1.zip / os2_top1 / APPS / PROG / C_PLUS / CNVLIB2 / ADSOUND.CMD next >
Encoding:
Text File  |  1994-08-02  |  3.3 KB  |  95 lines

  1. EXTPROC CEnvi
  2. //*** Adsound.cmd - access After Dark sound from Wipeout
  3. //***
  4. //*** I thought you might be interested in what I've been doing with your product.
  5. //*** The following program automates a process with Bocasoft's WipeOut program
  6. //*** while using it's After Dark server.  I wanted to be able to toggle the After
  7. //*** Dark sound easily, instead of going through the number of screens required.
  8. //*** Following is my solution.
  9. //***
  10. //*** You'll notice I took sections of sample program you created and made them
  11. //*** subroutines within this program.
  12. //***
  13. //*** I had to employ a trick because when I select the After Dark options button,
  14. //*** a subwindow is made active and the keystoke that brought up the window
  15. //*** freezes the program until the subwindow disappears.  This explains the
  16. //*** spawn command and the second routine used when spawned.
  17. //***
  18. //*** The use of VK_HOME and the VK_END, VK_UP sequence is to set the screen saver
  19. //*** to After Dark and to then reset the screen saver back to Random.
  20. //***
  21. //*** Because of how the WipeOut and After Dark server interact, once the program
  22. //*** finishes, all thats left is the MS Windows Sound Setup, where I can toggle
  23. //*** the sound.
  24. //***
  25. //*** no problem with you adding my sample program to your library.  Note that the
  26. //*** program assumes that the After Dark entry is at the beginning of the list
  27. //*** (uses the HOME key) and the Random entry I go back to is towards the bottom
  28. //*** of the list (uses the END key and some UP-ARROW keys to get back there).
  29. //*** This might change for other users.
  30. //***
  31. //***    Thank you, Edward Reddy, for contributing AdSound.cmd
  32.  
  33.  
  34.  
  35.  /* needed by winset and keypush */
  36. #include <PMdll.lib>
  37. #include <WinTools.lib>
  38.  /* needed by keypush */
  39. #include <KeyPush.lib>
  40.  
  41.  /* exist params */
  42. #define FOUND     0
  43. #define NOT_FOUND 1
  44.  /* end of exist params */
  45.  
  46. main(argc,argv)
  47. {
  48.    if (argc==1)
  49.    {
  50.       ShowWindow("BocaSoft WipeOut",SW_RESTORENOACTIVE);
  51.       thiswindow = make_active_window("BocaSoft WipeOut");
  52.       spawn(P_NOWAIT,"ADSOUND.CMD SUBWINDOW");
  53.       Keystroke(VK_HOME,VK_ALT,'O');
  54.       /* pause occurs here where subwindow locks Wipeout window */
  55.       /* must reset active window after pause */
  56.       thiswindow_temp = make_active_window("BocaSoft WipeOut");
  57.       Keystroke(VK_END,VK_UP,VK_UP,VK_UP,VK_UP,VK_UP);
  58.       restore_active_window(thiswindow);
  59.       ShowWindow("BocaSoft WipeOut",SW_MINIMIZE);
  60.    }
  61.  
  62.    if (argc==2 && !stricmp(argv[1],"SUBWINDOW"))
  63.    {
  64.       thiswindow = make_active_window("AD Settings");
  65.       Keystroke(VK_ALT,'S');
  66.       /* pause occurs here while Windows dialog occurs */
  67.       Keystroke(VK_ALT,'O');
  68.    }
  69. }
  70.  
  71.  /* use with keypush functions */
  72. make_active_window(title)
  73. {
  74.  
  75.       // save the currently active window to be restored
  76.       RememberActiveWindow = GetActiveWindow();
  77.  
  78.       // Set the active window to First argument
  79.       if (!SetActiveWindow(title) ) 
  80.       {
  81.          printf("Unrecognized Window Title \"%s\"\n\a",title);
  82.          exit(EXIT_FAILURE);
  83.       }
  84.       return (RememberActiveWindow);
  85. }
  86.  
  87. restore_active_window(RememberActiveWindow)
  88. {
  89.       // Restore currently active window
  90.       SetActiveWindow(RememberActiveWindow);
  91.    
  92. }
  93.  /* end of keypush functions */
  94.  
  95.