Example code in Delphi to use MessageWait method to synchronize threads. Example code include delphi project files.