Messages , as TMessage omits these fields from TMsg: That structure is not the same as the TMessage type inside the unit WinApi. Luckily, it is documented in the Windows SDK as the structure tagMSG. Unlike the documentation for the OnMessage event, the type inside the method is TMsg from the unit WinApi.Windows, which is an alias for the (documentation mentioned) tagMSG in the same unit neither type is documented at or. This means you will not see any synchronous messages sent to specific Windows using SendMessage. for performance reasons, it might be wise to have only the decision in this method, and all actual handling (including any managed variables) inside another method.Ĭapturing these messages is limited to the ones processed through the main message loop (or message pump): these are the asynchronous ones either put there by PostMessage or related functions (like PostQuitMessage), or generated by Windows. if you do not handle it: bail out as quickly as possible figure out if the TMsg should be handled set Handled to True if you do not want it to be processed by your application any further Since I had captures messages inside the main message loop, I forgot it is straightforward: create a TApplicationEvents instance, then use the OnMessage event and hook it to a method like procedure TMainForm.ApplicationEventsMessage( var Msg: TMsg var Handled: Boolean)
0 Comments
Leave a Reply. |