home *** CD-ROM | disk | FTP | other *** search
/ Mega Top 1 / os2_top1.zip / os2_top1 / APPS / PROG / C_PLUS / CNVLIB2 / NEARLOCK.CMD < prev    next >
Encoding:
Text File  |  1994-07-13  |  2.0 KB  |  90 lines

  1. EXTPROC CEnvi
  2. //**********************************************************
  3. //*** NearLock - Lockup desktop ALMOST.  That is lockup  ***
  4. //*** ver.1      except if printer message shows through ***
  5. //***            allow a message there.                  ***
  6. //**********************************************************
  7.  
  8. #include <WinTools.lib>
  9.  
  10. // Lockup system
  11. system(`start "Lockup Desktop" /C /WIN /B DeskLock LOCK`);
  12. suspend(4000);
  13. LockWindow = WinQuerySysModalWindow();
  14.  
  15. while ( True ) {  // run forever
  16.  
  17.    // check every second, waiting for the printer message
  18.    // window to show up or until lock window is gone
  19.    do {
  20.       suspend(1000);
  21.       if ( !IsWindow(LockWindow) )
  22.          exit(0);
  23.    } while ( !(PrintWindow = GetWindowHandle("Printer")) );
  24.  
  25.    // The printer window is showing, so make the printer
  26.    // window be modal and minimize the lockup window
  27.    WinSetSysModalWindow(PrintWindow);
  28.  
  29.    // stay here until the print window is done
  30.    while ( PrintWindow == WinQuerySysModalWindow() ) {
  31.       PutWindowOnTop(PrintWindow);
  32.       WinSetFocus(PrintWindow);
  33.       suspend(500);
  34.    }
  35. }
  36.  
  37.  
  38. // A couple of utilities called above
  39.  
  40. WinQuerySysModalWindow()
  41. {
  42.    #define ORD_WIN32QUERYSYSMODALWINDOW   827
  43.    return PMDynamicLink("PMWIN",ORD_WIN32QUERYSYSMODALWINDOW,
  44.                         BIT32,CDECL,HWND_DESKTOP);
  45. }
  46.  
  47. WinSetSysModalWindow(pHwnd)
  48. {
  49.    #define ORD_WIN32SETSYSMODALWINDOW     872
  50.    return PMDynamicLink("PMWIN",ORD_WIN32SETSYSMODALWINDOW,
  51.                         BIT32,CDECL,HWND_DESKTOP,pHwnd);
  52. }
  53.  
  54. PutWindowOnTop(pHwnd)
  55. {
  56.    #define HWND_TOP     3
  57.    #define SWP_ZORDER   4
  58.    #define ORD_WIN32SETWINDOWPOS    875
  59.    DynamicLink("PMWIN",ORD_WIN32SETWINDOWPOS,BIT32,CDECL,
  60.                pHwnd,HWND_TOP,0,0,0,0,SWP_ZORDER);
  61. }
  62.  
  63. WinSetFocus(pHwnd)
  64. {
  65.    #define ORD_WIN32SETFOCUS     860
  66.    DynamicLink("PMWIN",ORD_WIN32SETFOCUS,BIT32,CDECL,
  67.                HWND_DESKTOP,pHwnd);
  68. }
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.