|Navigation: Templates > Guide to all Templates > Extension Templates >====== MDI Synchronization - Global Extension ======|
This Global template has a single check box, which is used to include the MDI Synchronization Class libraries. By default, all procedures will include an MDI Synchronization Object, with the exception of Report procedures and Clarion Chain applications not using the ABC Class Libraries.
You can toggle this check box to test the application with or without the Synchronization objects.
Who needs to use this template
Based on our analysis, and on communications from Microsoft, two significant factors were identified that correlate with problems experienced in multi-threaded MDI applications:
·The presence of Menus on the MDI child window.
·Very fast opening or closing of MDI windows.
The MENU on child windows is generally only a factor when the MDI windows are being opened Maximized. These are some “worst-case” scenarios:
MDI child windows that are opened in a LOOP and are either maximized initially, or the program maximizes them directly on the basis of information stored in a user configuration files such as an INI file or in the Windows registry.
The program does something that requires the OS to update internal MDI structures, and before that can complete initiates another operation that also requires the same structure to be updated. For example, opening other windows, on the event EVENT:Sized. At the point when this event is processed, the Operating System may not have completed update of internal structures associated with the first MDI window, thus the internal OS structure becomes corrupted.
The program uses Menu's on the MDI Child windows and the windows are opened Maximized in a loop.
Effects you can see
The effects that you may encounter from code like the above are:
·The Menu bar on the FRAME is updated incorrectly
·The Windows list frequently contains fewer windows than are opened
·Under W9x/ME: frequent GPFs either during maximization or if the end-userchooses to tile or cascade opened windows.
·Ghost caption buttons on the FRAME which can cause a lockup on opening-maximization of numerous child windows
Sample “bad” code
Now let's look at some sample problem code:
MyCounter = GETINI( 'MDIsettings', 'NumberOfWindowsToOpen')
LOOP MyCounter times
This code is very likely to have problems, particularly on slower machines, and even more so on less robust OS's like W98/ME. It is generally a bad programming practice to write code like the above, especially if your application must run on W9x/ME OS's. However, the results from our tests using the 6.1 RTL and the new “MDIsynchro” class/template this code will generally succeed, — but it is not guaranteed because so much can depend on factors outside the control of your program; things such as Operating System, CPU speed, available memory/resources, number of other running processes may all affect your program.
Most of the problems found can be avoided with the use of the 6.1 Runtime Libraries and the new MDI synchronization template, however some problems may also require changes in your coding style.