M. Gallant 05/01/2002

This signed applet for IE4+ browsers uses Microsoft J/Direct technology to retrieve the top level windows enumeration using EnumWindows and the GetWindowText() and GetWindowThreadProcessId() win32 API functions implemented in the Win32 User32.dll library. The callback function is implemented as an inner-class to allow easy access from within the callback function to the Java applet gui components. The output shows the hex address of each window handle (hwnd), the ProcessID of the process that created the window, and the title windowtext for each window. The applet also demonstrates closing a win32 window by using the function:
SendMessage (int winhandle, WM_SYSCOMMAND, SC_CLOSE, 0)

Source Code
HOWTO: Programmatically Close a Separate Application (Q176391)

Java applications versions:
Application with Separate Callback class
Application with inner-class callback