home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / switchto.zip / Read.me < prev    next >
Text File  |  1998-04-01  |  7KB  |  142 lines

  1. ******************************************************************************
  2.                                   Announcing
  3.  
  4.                           SwitchTo/2 Version 1.20 for
  5.                                    IBM OS/2
  6.           Copyright (C) by Roman Stangl (rstangl@vnet.ibm.com), 1998
  7.  
  8. ******************************************************************************
  9.  
  10. Dear User, Lieber Benutzer!
  11.  
  12. SwitchTo/2 allows you to switch a session locateable in the Window into the
  13. foreground from a commandline. For your info, I had the need to switch a
  14. certain fullscreen OS/2 session into the foreground to get it the priority
  15. boost the foreground session gets under OS/2 automatically (unless you have
  16. specified PRIORITY=ABSOLUTE in your CONFIG.SYS) from STARTUP.CMD on an 
  17. unattended workstation, where the Netfinity Systems Management Application
  18. is the only interface to force daily reboots remotely. 
  19.  
  20. From a programmer's viewpoint, SwitchTo/2 shows how to call PM APIs from a 
  21. non-PM session. Creating a message queue with WinCreateMsgQueue() fails with
  22. and PMERR_NOT_IN_A_PM_SESSION if the session this API was called from is not
  23. a PM session. The point is how a PM session is defined.
  24.  
  25. It is assumed widely that specifying the attribute WINDOWAPI in the module
  26. definition file defines that a program will start in a PM session, or
  27. WINDOWCOMPAT to start it in a AVIO session. This is true insofar, that
  28. when the WPS (and likely other launchers) launches the program, it takes
  29. these attribute from the executable file and creates a corresponding session
  30. environment. However, you can force a AVIO session into a PM session
  31. environment by overriding the attribute (e.g. by supplying the option /PM
  32. when starting is from a commandline).
  33.  
  34. SwitchTo/2 simply does that when compiled with the macro LAUNCHCOPY defined. 
  35. Once invoked from a commandline as a AVIO (commandline) session, it launches 
  36. itself in a PM session again, from where it then can call any PM API (though 
  37. just for enumerating the Window List and switching to a session no message 
  38. queue is required and therefore it could also be done by just a AVIO session, 
  39. enhancements requireing a message queue are easy to imagine). By using a 
  40. termination queue the AVIO session ensures to receive the return code of the 
  41. PM session. By the way, the JAVA interpreter does the same trick, as it can 
  42. also launch non-AWT and AWT base applications from the same executable.
  43.  
  44. When compiled with the macro CHANGETYPE defined, SwitchTo/2 just changes its
  45. application type, by overriding the value retrieved from the program info
  46. block. That way PM APIs can be called and the output to STDOUT is still
  47. visible when invoked from a command line.
  48.  
  49. This archive contains the following files:
  50. SwitchTo.exe .. SwitchTo/2 executable
  51. SwitchTo.msg .. SwitchTo/2 message file (renamed SW2Us.msg or SW2Gr.msg)
  52. Read.me ....... This file
  53. SwitchTo.cpp .. Source code
  54. SwitchTo.hpp .. Source code
  55. SwitchTo.def .. Source code
  56. SW2Us.txt ..... English message file source
  57. SW2Gr.txt ..... German message file source
  58. SW2Us.msg ..... English message file
  59. SW2Gr.msg ..... German message file
  60. Makefile ...... Makefile
  61.  
  62. You may freely distribute/modify this program, provided the complete source
  63. is included. 
  64.  
  65. You are welcome to drop me some comments or to visit my homepage at the URL:
  66. http://www.geocities.com/SiliconValley/Pines/7885/
  67.  
  68. Warm regards from Austria! Roman
  69.  
  70. ******************************************************************************
  71.  
  72. SwitchTo/2 erlaubt es Dir, eine in der Fensterliste befindliche Session von
  73. einer Befehlszeile aus in the Vordergrund zu schalten. Zur Information, ich
  74. hatte den Bedarf einen Gesamtbildschirm in den Vordergrund zu schalten, um 
  75. die Prioritätserhöhung die OS/2 automatisch der Session im Vordergrund zu-
  76. kommen lässt (ausser PRIORITY=ABSOLUTE ist in der CONFIG.SYS angegeben)
  77. auszunutzen. Da es sich dabei um eine unbeaufsichtigte Workstation handelte,
  78. die täglich remote durch das Netfinity Systems Management rebootet wird,
  79. musste das in der STARTUP.CMD automatisiert werden.
  80.  
  81. Programmiertechnisch zeigt SwitchTo/2 wie man PM APIs aus einer nicht-PM
  82. Session aufrufen kann. Die Erzeugung einer Message Queue mittels 
  83. WinCreateMsgQueue() schlägt mit PMERR_NOT_IN_A_PM_SESSION fehl, wenn die 
  84. Session von der der API aufgerufen wurde keine PM Session ist. Der Punkt ist
  85. wie eine PM Session definiert wird.
  86.  
  87. Es wird weit verbreitet angenommen, dass die Angabe des Attributes WINDOWAPI
  88. in der Module Definition Datei definiert, ob ein Programm in einer PM Session
  89. gestartet wird, bzw. WINDOWCOMPAT um in eine AVIO Session zu starten. Das ist
  90. insofern korrekt, als dass die WPS (und wahrscheinlich andere Programmstarter)
  91. das Programm anhand dieses Attributes im Executable in die entsprechende 
  92. Session starten. Aber, man kann den Start einer AVIO Session in eine PM
  93. Session erzwingen, indem man das Attribut überschreibt (z.B. durch Angabe der
  94. Option /PM in einer Befehlszeile). 
  95.  
  96. SwitchTo/2 macht genau das wenn beim Kompilieren das Makro LAUNCHCOPY 
  97. definiert ist. Beim Aufruf von einer Befehlszeile wird es als AVIO 
  98. (Befehlszeilen-) Session gestartet. Es startet sich dann jedoch selbst
  99. nocheinmal in eine PM Session, von der es dann PM APIs aufrufen kann (obwohl
  100. um die Fensterleiste zu enumerieren und zu einer Session zu schalten ist 
  101. keine Message Queue nötig und könnte daher von einer AVIO Session gemacht
  102. werden, es sind aber leicht Erweiterungen vorstellbar, die eine Message Queue
  103. erfordern). Durch Verwendung einer Termination Queue stellt die AVIO Session
  104. sicher, den Rückgabecode der PM Session feststellen zu können. Übrigends, der 
  105. JAVA Interpreter benutzt den selben Trick, er kann dadurch sowohl nicht-AWT 
  106. als auch AWT Applikationen durch das selbe Executable starten.
  107.  
  108. When compiled with the macro CHANGETYPE defined, SwitchTo/2 just changes its
  109. application type, by overriding the value retrieved from the program info
  110. block. That way PM APIs can be called and the output to STDOUT is still
  111. visible when invoked from a command line.
  112.  
  113. Wenn beim Kompilieren das Makro CHANGETYPE definiert ist, ändert SwitchTo/2
  114. einfach seinen Typ, indem der Wert vom Prozess Informations Block (PIB)
  115. überschreiben wird. Dadurch können ebenfalls PM APIs aufgerufen werden, und
  116. die Ausgabe auf STDOUT ist dennoch sichtbar wenn das Programm von einer
  117. Befehlszeile aufgerufen wurde.
  118.  
  119. Dieses Archive enthält folgende Dateien:
  120. SwitchTo.exe .. SwitchTo/2 Executable
  121. SwitchTo.msg .. SwitchTo/2 Nachrichtendatei (umbenannte SW2Us.msg oder 
  122.                 SW2Gr.msg)
  123. Read.me ....... Diese Datei
  124. SwitchTo.cpp .. Quellencode
  125. SwitchTo.hpp .. Quellencode
  126. SwitchTo.def .. Quellencode
  127. SW2Us.txt ..... Englische Nachrichtendatei Quellencode
  128. SW2Gr.txt ..... Deutsche Nachrichtendatai Quellencode
  129. SW2Us.msg ..... Englische Nachrichtendatei
  130. SW2Gr.msg ..... Deutsche Nachrichtendatei
  131. Makefile ...... Makefile
  132.  
  133. Du bist auch willkommen mir eine Nachricht zu schicken, oder meine Homepage
  134. mit folgender URL zu besuchen:
  135. http://www.geocities.com/SiliconValley/Pines/7885/
  136.  
  137. Du kannst dieses Programm frei verteilen/modifizieren, vorrausgesetzt der
  138. komplette Quellencode wird inkludiert.
  139.  
  140. Mit freundlichen Grüssen aus Österreich! Roman
  141.  
  142.