Using Intel® Visual Fortran to Create and Build Windows*-Based Applications

ID 757211
Date 7/23/2021
Document Table of Contents

Using Callback Routines

All callback routines run in a separate thread from the main program. As a result, all multithread issues apply. In particular, sharing data, drawing to windows, and doing I/O must be properly coordinated and controlled.

QuickWin callback routines, both for menu callbacks and mouse callbacks, should do a minimum of processing and then return. While processing a callback, the program will appear to be non-responsive because messages are not being serviced. This is why it is important to return quickly.

If more processing time is needed in a callback, another thread should be started to perform this work; threads can be created by calling the Windows API CreateThread. If a callback routine does not start a new thread, the callback will not be reentered until it is done processing.