Unfortunately, the method has two drawbacks; First, it uses an undocumented user message, which may change in future Windows versions, and second, it does not work under Windows XP, since the 'magic procedure' to exit windows is different (open the shutdown dialog, then cancel it pressing SHIFT-CTRL-ALT-ESC) and no message posting is involved there.
How to exit explorer.exe gracefully on Windows XP and Windows Vista 7
It would be nice to have a reliable and portable way to terminate explorer cleanly from another process regardless of the windows version. So I continued debugging into the disassembly of the code which terminates explorer cleanly in order to find a hint about how I could achieve this. I still don't have the perfect solution but I made some interesting observations (on Windows 7 and Windows XP) which I want to share with whoever might be interested:
I learned by experimentation that the remaining explorer.exe process finally terminates on a WM_QUIT after the windows are closed. Sending a WM_QUIT, as long there are open folder windows, simply gets ignored.
The final shutdownExplorer() function first sends messages to the explorer.exe windows, then waits 10 seconds for their termination while sending WM_QUIT to their main processes. Processes that are alive another 10 seconds later, get terminated.
I like to see my open windows ungrouped, but realized that this i.e. closing multiple windows at once was a problem with such a setting. A less time-taking method would be to use the command line like this :
The 'com2java' tool now issues a warning if a method parameter is not marked as being [in], [in out] or [out] The 'com2java' tool now supports aliases in type libraries The examples in the documentation have been updated to always include [in], [out], or [in, out] in IDL method definitions. You can now purchase a J-Integra license on-line by Credit Card.What's new in J-Integra v1.2.0? (Released April 12, 1999)COM unsigned chars now map to Java bytes. They used to be mapped to Java integers. If you have licensed J-Integra and are impacted by this change, please contact us The documentation examples have been updated to reflect the fact that it is now no longer always necessary to specify the domain/user/password to be used when accessing COM objects from Java. The 'java2com' tool now has a GUI. Step-by-step examples of accessing Java objects as COM objects have been added:Visual Basic to Java (late bound) Visual Basic to Java (early bound) Visual C++ to Java Excel Visual Basic (VBA) to JavaWe have added basic support for invoking COM object methods at runtime by name. A troubleshooting guide has been added.What's new in J-Integra v1.2.0 Beta 1? (Released March 16, 1999)There is now no need to specify domain/user/password if logged in to a Windows machine. Make sure that the J-Integra bin directory is in your PATH. J-Integra will use your local credentials (interactive user) if you have not specified authentication information (either using com.linar.jintegra.AuthInfo.setDefault()) or by passing an authInfo parameter to a proxy constructor. Note that the documentation has yet to be updated to reflect this. There is now full support for COM access to Java objects. Previously you had to use callbacks, not any more. Check out the updated section on Accessing Java objects from COM. Access instances of any public class running in any JVM, including Java 2 on any platform from COM. Long passwords no longer cause IndexOutOfBounds exceptions You can now use the queryInterface method on an interface proxy to cause it to query the remote COM object to see if it really does implement the interface. By default J-Integra delays this query until the first method call. An example of accessing Word document attributes (author, title, manager etc) has been added to the examples directory in the kit. The static com.linar.jintegra.Log.logImmediately(int logLevel, PrintStream logFile) can now be called to tell J-Integra to not log messages in a background low priority thread (which it does by default). This beta will expire in one month (17th April). We plan on releasing the full v1.2 well before that. About time to place that order ;-)What's new in J-Integra v1.1.0? (Released January 29, 1999)Added lots more examples to the kit, in a separate examples subdirectory. Added support for arrays outside of Variants (VC examples and VB examples included) The "equals()" method has been overridden on references to remote objects, and you can now compare references to remote objects to see if they refer to the same object (uses DCOM OID). Support for marshalling COM Structures has been added as an experimental feature. Take a look at the examples/ms_vc/structs directory in the kit. Structures are mapped by J-Integra to Java classes with all fields as public member variables. The VT_INT Automation type has can now be used. Setting the property TCP_NODELAY to any value causes a java.net.Socket.setTcpNoDelay(true) to be invoked on all sockets opened by J-Integra An example of accessing Java objects from Active Server Pages has been included in the examples subdirectory. The 'com2java' tool now accepts command line parameters - pass a '?' to see the syntax. Note that the tool runs asynchronously. The Applet Example has been extended to demonstrate how to go beyond the sandbox by using the Java Plugin. Java objects can now generate COM events (although to the Java objects they look just like Java events). Both Visual C++ and Visual BASIC examples are included in the examples subdirectory. Added pointer to an article on using J-Integra with IBM's WebSphere Application Server to the Application Server documentation.What's new in J-Integra v1.01? (Released December 7, 1998)A bug causing callbacks and events to not work in some circumstances has been fixed. Added option to the 'com2java' tool to leave method names unchanged. By default method names are changed to start with a lowercase letter, as is the convention for Java. Minor documentation updates. Code obfuscator update has resolved verifier errors when using J-Integra with JDK1.2 J-Integra now propogates DCOM Causality IDs correctly. Fixed bug causing TCP/IP connections to the DCOM SCM to not be correctly closed. Runtime expiry date updated to 31st Jan 1999 (unless a license is purchased and installed).What's new in J-Integra v1.00? (Released November 8, 1998)Fixed a problem handling remote object references whereby the wrong protocol address was sometimes being used (rather than TCP/IP). Fixed a bug in the handling of two-dimensional variant arrays Added new com.linar.jintegra.Authentication.setDefault() method, used to set the default authentication to be used when none is specified when creating a COM component. Fixed bug in J-Integra's handling of DCOM ComplexPing calls into J-Integra's OXID Resolver from remote systems. Added example of the use of J-Integra from GUI development environments (IBM's VisualAge) to the documentation. Incorporated some of the J-Integra test-suite into the kit, as examples of the use of J-Integra. Added support for COM classes implementing multiple interfaces. The corresponding Java class now implements the interfaces, and allows their methods to be invoked. Better detection of COM servers exiting. J-Integra now throws EOFException if an attempt is made to talk to a COM component that has unexpectedly disappeared.What's new in J-Integra Beta 0.06? (Released October 18, 1998)Added possibility of specifying the prefix to be used by com2java in situations where a COM interface name, method, or parameter name etc clashes with a Java reserved word. com2java now generates event adapter classes to make implementing event interfaces more convenient. It also generates a class for each method in event interfaces, containing all of the parameters to that method. The class is then passed as the sole parameter to the method. This is because the convention for event methods is that there is a sole parameter. J-Integra generated classes and interfaces can now be correctly manipulated in GUI builder tools which analyze classes to determine properties, methods and events (prior to this release, events were not recognized because they did not adhere to the convention). Added a new method getPropertyByName(String name) to classes generated by com2java. This method can be used to get a property at runtime, based on its name. This is used in the excel example Windows 95 code, and obviates the need for the 'always Dispatch' checkbox in the com2java tool, which was introduced in Beta 0.03. Added the Application Server (NetDynamics) example to the documentation. Added the Excel Charting, Outlook and Shell (minimises all windows, lists local hard drives) examples to the documentation.What's new in J-Integra Beta 0.05? (Limited release)Fixed problem in com2java tool for cases where interface A derives from interface B, and B is marked as 'hidden' in the type library.What's new in J-Integra Beta 0.04? (Released September 31, 1998)Added support for cases where one interface derives from another, such as the ADO._RecordSet deriving from ADO._ADO Fixed problem with passing a reference to a remote object as a parameter in COM interface method calls. Fixed problem with arrays of IUnknowns. Added tentative support for 'oleautomation' interfaces in the 'com2java' tool.What's new in J-Integra Beta 0.03? (Released September 24, 1998)Allowed possibility of only generating Dispatch interfaces to remote components, in order to work around an apparent Excel bug, which manifests itself under Windows 95/98, with a message that the Workbook class does not implement the _Workbook interface.There is now a "Only Dispatch" checkbox in the com2java tool. Check this checkbox to only generate Dispatch interfaces. You should do this if you will be accessing Excel under Windows 95/98. Note that the rest of the documentation has not been updated to reflect this new checkbox. 2ff7e9595c
Comments