home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / iwftech.zip / samples / Launch / launch.c next >
Text File  |  1994-07-21  |  3KB  |  69 lines

  1. /*+--------------------------------------------------------------------------+*/
  2. /*|WF/2 Launching actions sample                                             |*/
  3. /*|--------------------------------------------------------------------------|*/
  4. /*|                                                                          |*/
  5. /*| PROGRAM NAME: LAUNCH                                                     |*/
  6. /*| -------------                                                            |*/
  7. /*|                                                                          |*/
  8. /*| COPYRIGHT:                                                               |*/
  9. /*| ----------                                                               |*/
  10. /*| Copyright (C) International Business Machines Corp., 1991,1992,1993,1994.|*/
  11. /*|                                                                          |*/
  12. /*| DISCLAIMER OF WARRANTIES:                                                |*/
  13. /*| -------------------------                                                |*/
  14. /*| The following [enclosed] code is sample code created by IBM              |*/
  15. /*| Corporation.  This sample code is not part of any standard IBM product   |*/
  16. /*| and is provided to you solely for the purpose of assisting you in the    |*/
  17. /*| development of your applications.  The code is provided "AS IS",         |*/
  18. /*| without warranty of any kind.  IBM shall not be liable for any damages   |*/
  19. /*| arising out of your use of the sample code, even if they have been       |*/
  20. /*| advised of the possibility of such damages.                              |*/
  21. /*|                                                                          |*/
  22. /*| REVISION LEVEL: 2.1                                                      |*/
  23. /*| -------------------                                                      |*/
  24. /*|                                                                          |*/
  25. /*|  This program illustrates registering a non-PM program with WF/2 and     |*/
  26. /*|  launching context sensitive actions. Also, this program does not        |*/
  27. /*|  statically link to WF/2, and can be used where WF/2 support is optional.|*/
  28. /*|                                                                          |*/
  29. /*+--------------------------------------------------------------------------+*/
  30. #define INCL_ERRORS
  31. #define INCL_DOS
  32. #define INCL_WIN
  33. #include <os2.h>
  34.  
  35. #include <stdio.h>
  36. #include <stdlib.h>
  37. #include <string.h>
  38. #define MAX_FILES 10
  39.  
  40. extern BOOL _System WkfLaunchAction( PSZ   pszProject,
  41.                                      PSZ   pszAction,
  42.                                      PSZ * ppszFiles );
  43.  
  44. int main( int argc, char * argv[] )
  45.    {
  46.    char * ppFiles[MAX_FILES+1];
  47.    char * pcProject;
  48.    char * pcAction;
  49.    int    i;
  50.  
  51.    if ( argc < 3 )
  52.       {
  53.       puts("<Project name> <action> <files...>");
  54.       exit(255);
  55.       }
  56.  
  57.    pcProject = argv[1];
  58.    pcAction  = argv[2];
  59.    for( i=3; i<argc && i<MAX_FILES; ++i )
  60.       ppFiles[i-3] = argv[i];
  61.  
  62.    ppFiles[i-3] = NULL;
  63.  
  64.    if ( FALSE == WkfLaunchAction( pcProject, pcAction, ppFiles ) )
  65.       puts("False returned" );
  66.    return( 0 );
  67.    }
  68.  
  69.