Search code examples
delphimultithreadingmultimedia

How best to notify my Delphi App from a Windows callback


I'm using the Multimedia timer in Delphi and this works great for quite accurate callbacks (compared to a traditional TTimer). However the callback is from another thread. I dont have a convenient form to use for PostMessage() or a message based means of notifying my app that the callback has happened - I just have a class. I'm happy with a message based solution (if necessary). What is the easiest way of sending some kind of event from the Windows callback into my class? THanks Brian


Solution

  • The standard solution is to create an invisible window using AllocateHWnd procedure as a field of your class to receive messages sent from callback function. A nice usage example of AllocateHWnd procedure is TTimer component.