home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cenvi23.zip / DESKLOCK.CMD < prev    next >
OS/2 REXX Batch file  |  1994-10-03  |  1KB  |  49 lines

  1. EXTPROC CEnvi2
  2. //*********************************************
  3. //*** DeskLock.cmd - Lock or unlock desktop ***
  4. //*** ver.1                                 ***
  5. //*********************************************
  6.  
  7. main(argc,argv)
  8. {
  9.    if ( argc == 2   &&  !stricmp(argv[1],"LOCK") ) {
  10.       success = WinLockupSystem(PMInfo().hab);
  11.    } else if ( argc == 3  &&  !stricmp(argv[1],"UNLOCK") ) {
  12.       Password = argv[2];
  13.       success = WinUnlockSystem(PMInfo().hab,Password);
  14.    }
  15.    else {
  16.       success = False;
  17.       Instructions();
  18.    }
  19.    return success ? EXIT_SUCCESS : EXIT_FAILURE ;
  20. }
  21.  
  22. Instructions()
  23. {
  24.    puts("\a")
  25.    puts("DeskLock - Lock or UnLock OS/2 desktop")
  26.    puts("")
  27.    puts("USAGE: DeskLock [ LOCK | UNLOCK <password> ]")
  28.    puts("")
  29.    puts("WHERE: LOCK - Lockup desktop")
  30.    puts("       UNLOCK - Unlock desktop")
  31.    puts("       password - Password for unlocking")
  32.    puts("")
  33.    printf("ERRORLEVEL: Return ERRORLEVEL %d for success, else %d\n",EXIT_SUCCESS,EXIT_FAILURE);
  34.    puts("")
  35. }
  36.  
  37. WinLockupSystem(pHab)
  38. {
  39.    #define ORD_WIN32LOCKUPSYSTEM 283
  40.    return PMDynamicLink("PMWP",ORD_WIN32LOCKUPSYSTEM,BIT32,CDECL,pHab);
  41. }
  42.  
  43. WinUnlockSystem(pHab,pPassword)
  44. {
  45.    #define ORD_WIN32UNLOCKSYSTEM 282
  46.    return PMDynamicLink("PMWP",ORD_WIN32UNLOCKSYSTEM,BIT32,CDECL,pHab,pPassword);
  47. }
  48.  
  49.