home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / objst11.zip / proghand.c < prev    next >
C/C++ Source or Header  |  1995-07-20  |  1KB  |  43 lines

  1. #define INCL_WINWORKPLACE
  2. #include <os2.h>
  3. #include <stdio.h>
  4. #include <string.h>
  5.  
  6. HOBJECT     progobjid;
  7. PSZ        pszClassName="WPProgram";
  8. PSZ             pszTitle;
  9. PSZ             pszDefaultTitle="Objst Default Title";
  10. PSZ        pszSetupString;
  11. PSZ        pszLocation="<WP_DESKTOP>";
  12. ULONG        ulFlags=CO_FAILIFEXISTS;
  13. char        charTitle[500];
  14. char        *space=" ";
  15.  
  16. main(int argc, char *argv[])
  17. {
  18.    int i;
  19.  
  20.    if (argc==1) {
  21.       progobjid=WinCreateObject(pszClassName,pszDefaultTitle,pszSetupString,pszLocation,ulFlags);
  22.       if (progobjid==0) {
  23.          printf("\nAn object with that title already exists on the desktop.\n\n");
  24.       } else {
  25.          printf("\nThe Program Object ID is: %6d\n\n",(ULONG) progobjid);
  26.       }
  27.    } else {
  28.       strcat(charTitle,argv[1]);
  29.       for (i=2;i<argc;i++) {
  30.          strcat(charTitle,space);
  31.          strcat(charTitle,argv[i]);
  32.       }
  33.       pszTitle=(PSZ) &charTitle;
  34.       progobjid=WinCreateObject(pszClassName,pszTitle,pszSetupString,pszLocation,ulFlags);
  35.       if (progobjid==0) {
  36.          printf("\nAn object with that title already exists on the desktop.\n\n");
  37.       } else {
  38.          printf("\nThe Program Object ID is: %6d\n\n",(ULONG) progobjid);
  39.       }
  40.    }
  41. }
  42.  
  43.