home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / wpstools.lzh / DESTOBJ.C next >
C/C++ Source or Header  |  1992-03-14  |  1KB  |  51 lines

  1. /* Destobj.c -- destroy WPS object
  2.    Usage:
  3.       DESTOBJ objid
  4.    By Ned Konz 3/14/92
  5. */
  6.  
  7. #include <stdio.h>
  8.  
  9. #define INCL_WINWORKPLACE
  10. #include <os2.h>
  11.  
  12. /*
  13. HOBJECT APIENTRY WinCreateObject(PSZ pszClassName,
  14.                                 PSZ pszTitle,
  15.                                 PSZ pszSetupString,
  16.                                 PSZ pszLocation,
  17.                                 ULONG ulFlags );
  18. #define CO_FAILIFEXISTS     1
  19. #define CO_REPLACEIFEXISTS  2
  20. #define CO_UPDATEIFEXISTS   4
  21.  
  22. BOOL APIENTRY WinSetObjectData(HOBJECT hObject,
  23.                                 PSZ pszSetupString);
  24.  
  25. BOOL APIENTRY WinDestroyObject(HOBJECT hObject);
  26.  
  27. HOBJECT APIENTRY WinQueryObject(PSZ pszObjectID);
  28. */
  29.  
  30. int main( int argc, char *argv[] )
  31. {
  32.     HOBJECT hObject;
  33.  
  34.     if (argc != 2) {
  35.         fputs("Usage: ", stderr);
  36.         fputs(argv[0], stderr);
  37.         fputs(" objid\n", stderr);
  38.         return 1;
  39.     }
  40.  
  41.     hObject = WinQueryObject((PSZ)argv[1]);
  42.     if (hObject) {
  43.         return !WinDestroyObject(hObject);
  44.     } else {
  45.         fputs("Object ", stderr);
  46.         fputs(argv[1], stderr);
  47.         fputs(" Not found!\n", stderr);
  48.         return 2;
  49.     }
  50. }
  51.