<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2912" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Nevermind, I worked out what I need to do.&nbsp; I 
should be using&nbsp;OnMessage rather than OnIdle for a start.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>This is all that is needed to handle non-modal DLL 
dialog forms.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>procedure TEngine.ApplicationEventsMessage(var Msg: 
tagMSG; var Handled: Boolean);<BR>begin<BR>&nbsp; if not Local and 
IsDialogMessage(GetParent(Msg.hwnd),Msg) then Handled := 
True;<BR>end;</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>The "Local" boolean is&nbsp;messy and there is 
likely to be a much better way to do this.&nbsp;&nbsp;What I do is set Local to 
true when any local forms get the focus, and to false when leaving focus.&nbsp; 
This way when a DLL form receives the focus, Local is false and all dialog 
messages are assumed to be coming from controls on the DLL dialog.&nbsp; 
GetParent of the control where tab was pressed is the dialog window of 
course.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>I also need to set Local to true before any modal 
dialog such as that created with MessageDlg or ShowMessage, which again is 
messy, but at least it works.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>If anyone can suggest a better way of detecting if 
a local window or dialog has the focus then I would love to know.&nbsp; 
I've&nbsp;learnt a lot about windows messaging the last few days, more than I 
hoped to ever know, but I still have little clues how to do this.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>As I see it, the above code should enable tabs and 
other key messages to be processed for all non-modal DLL Forms.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Regards,</FONT></DIV>
<DIV><FONT face=Arial size=2>Ross.</FONT></DIV></BODY></HTML>