Clarion projects – Window structures in the RTL

Clarion projects – Window structures in the RTL

The following is excerpted from an MS KB article:
The Microsoft Platform Software Development Kit (SDK) documentation for the CreateMDIWindow function says that “(u)sing the CreateMDIWindow function is similar to sending the WM_MDICREATE message to an MDI client window, except that the function can create an MDI child window in a different thread, while the message cannot.”

Applications that use the CreateMDIWindow function to create a multiple-document interface (MDI) child window on a thread other than the thread that owns the MDICLIENT window may experience problems with the way that MDI manages the client windows. The following problems may occur:

  • – The list of windows on the frame’s window menu may not be complete.
  • – The management of the MDICLIENT scroll bars may not be consistent when you move or size MDI child windows.
  • – The keyboard cannot be used to move between the menus in the frame window and an MDI child window.

RESOLUTION To resolve this problem, applications should not call the CreateMDIWindow function to create MDI child windows on a thread other than the thread that owns the frame window and the MDICLIENT window (emphasis added).

So there you have it. MS doesn’t want or support multi-threaded MDI programs at all.  In fact the .Net runtime displays an error message if you even try to open a window on any but the programs main thread. We have spent literally hundreds of man-hours trying to make MS MDI behave in a multi-threaded program. We know the real life implementation of the MDI API is not thread safe, and never will be. To workaround this deficit we have encumbered the RTL with synchronization code to try to mitigate the OS level problems. I say encumbered; (restrict or burden (someone or something) in such a way that free action or movement is difficult) because that best describes the situation. The extra code we were forced to add restricts our ability to add new functionality, without risking breaking the MDI synchronization sequence we spent so much time on making it work.  So to move forward we have a project underway that will allow us to remove the burden of the synchronization objects, solve all of the above listed MDI issues, and best of all, allow us to add new functionality with 100% backward compatibility.

At next weeks DevCon I’ll be going into the details of what we are doing to solve this issue once and for all, and describing the exciting new abilities that it will bring to Clarion programs.