<!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.2800.1400" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Try passing the main program's Application variable 
to the DLL when it is first loaded and have the DLL replace it's own Application 
variable during an intialisation routine (keeping a reference to it's own 
Application variable). Then, last thing before the DLL is unloaded, after all 
resources have been freed (ie, the DLL should clean up it's own form), reset the 
Application variable back to the original.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Cheers,</FONT></DIV>
<DIV><FONT face=Arial size=2>Phil.</FONT></DIV>
<BLOCKQUOTE 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV 
  style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> 
  <A title=robertw@cellect.co.nz href="mailto:robertw@cellect.co.nz">Robert 
  Wilson</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>To:</B> <A title=delphi@ns3.123.co.nz 
  href="mailto:delphi@ns3.123.co.nz">NZ Borland Developers Group - Delphi 
  List</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>Sent:</B> Monday, November 01, 2004 10:02 
  AM</DIV>
  <DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [DUG] Form in DLL</DIV>
  <DIV><BR></DIV><BR><FONT face=sans-serif size=2>Allen</FONT> <BR><BR><FONT 
  face=sans-serif size=2>I was working on an application a while back with same 
  sort of architecture, dll's within the main app form and found the same sort 
  of problems. The only way we found around the problem was to manually set 
  focus on each control within the dll.</FONT> <BR><BR><FONT face=sans-serif 
  size=2>Regards</FONT> <BR><FONT face=sans-serif size=2>Robert Wilson 
  </FONT><BR><BR><FONT face=sans-serif size=2><BR></FONT><IMG 
  src="cid:004d01c4bf90$8ad1fd30$0a01a8c0@mts32cus"><FONT face="Times New Roman" 
  size=3> &nbsp;</FONT> <BR><BR><BR>
  <TABLE width="100%">
    <TBODY>
    <TR vAlign=top>
      <TD>
      <TD><FONT face=sans-serif size=1><B>Allan Vergara &lt;<A 
        href="mailto:allan@workpace.com">allan@workpace.com</A>&gt;</B></FONT> 
        <BR><FONT face=sans-serif size=1>Sent by: 
        delphi-bounces@ns3.123.co.nz</FONT> 
        <P><FONT face=sans-serif size=1>01/11/2004 09:45</FONT> <BR><FONT 
        face=sans-serif size=1>Please respond to NZ Borland Developers Group - 
        Delphi List</FONT> <BR></P>
      <TD><FONT face=Arial size=1>&nbsp; &nbsp; &nbsp; &nbsp; </FONT><BR><FONT 
        face=sans-serif size=1>&nbsp; &nbsp; &nbsp; &nbsp; To: &nbsp; &nbsp; 
        &nbsp; &nbsp;NZ Borland Developers Group - Delphi List 
        &lt;delphi@ns3.123.co.nz&gt;</FONT> <BR><FONT face=sans-serif 
        size=1>&nbsp; &nbsp; &nbsp; &nbsp; cc: &nbsp; &nbsp; &nbsp; 
        &nbsp;</FONT> <BR><FONT face=sans-serif size=1>&nbsp; &nbsp; &nbsp; 
        &nbsp; Subject: &nbsp; &nbsp; &nbsp; &nbsp;[DUG] Form in 
    DLL</FONT></TR></TBODY></TABLE><BR><BR><BR><FONT face=Arial color=blue 
  size=2>Good morning all,</FONT><FONT face="Times New Roman" 
  size=3>&lt;?xml:namespace prefix = o ns = 
  "urn:schemas-microsoft-com:office:office" /&gt;</FONT> <BR><FONT 
  face="Times New Roman" size=3>&nbsp;</FONT> <BR><FONT face=Arial color=blue 
  size=2>I have a form in a DLL that I want to dock on a panel that live in the 
  main application. &nbsp;I'm passing the handle of the panel on to the DLL and 
  using Windows.SetParent to dock the form. &nbsp;This works fine but the DLL 
  form doesn't get any focus when I tab around the main application form. 
  &nbsp;Furthermore, when I manually set focus on one of the control on the DLL 
  form, I noticed that the main application form loses focus. &nbsp;</FONT> 
  <BR><FONT face="Times New Roman" size=3>&nbsp;</FONT> <BR><FONT face=Arial 
  color=blue size=2>I've tried synchronizing the main app's TApplication handle 
  and the DLL TAplication handle; no luck there. &nbsp;I've also tried assigning 
  the panel's handle to the ParentWindow property of the DLL form and I got some 
  interesting behaviours. &nbsp;The DLL form now receives focus and the main 
  app's title bar seems to behave properly but there is a problem... I have 3 
  TWinControl in my DLL form but for some reason only one of them is getting 
  focus. &nbsp;Say control1 has focus, the next time I push the tab key, the 
  focus jumps back on one of the control on the main application &nbsp;(I have 
  tabstop set to true for all 3 controls). &nbsp;This is causing me a lot of 
  headaches lately so any help/comments will be much appreciated :)</FONT> 
  <BR><FONT face="Times New Roman" size=3>&nbsp;</FONT> <BR><FONT face=Arial 
  color=blue size=2>Cheers folks</FONT> <BR><FONT face=Arial color=blue 
  size=2>Allan</FONT> <BR><FONT face="Microsoft Sans Serif" size=2>&nbsp; 
  </FONT><FONT face="Courier New" 
  size=2>_______________________________________________<BR>Delphi mailing 
  list<BR>Delphi@ns3.123.co.nz<BR>http://ns3.123.co.nz/mailman/listinfo/delphi<BR></FONT><BR><BR>
  <HR>
  <STRONG><FONT color=#ff0000>Attention: </FONT></STRONG><BR>Disclaimer: 
  <P>The information in this electronic mail message is confidential and may be 
  legally privileged. It is intended solely for the addressee. Access to this 
  Internet electronic mail message by anyone else is unauthorised. </P>
  <P>If you are not the intended recipient, any disclosure, copying, 
  distribution or any action taken or omitted to be taken in reliance on it is 
  prohibited and may be unlawful. <BR>If you&nbsp; have received this e-mail by 
  mistake please call the sender immediately on 09 415 4747 and erase the 
  original message and any attachments.</P>
  <P>Cellular Cellnet (NZ) Ltd accepts no responsibility for any effects this 
  email message or attachments has on the recipient network or computer system. 
  <HR>

  <P></P>
  <P>
  <HR>

  <P></P>_______________________________________________<BR>Delphi mailing 
  list<BR>Delphi@ns3.123.co.nz<BR>http://ns3.123.co.nz/mailman/listinfo/delphi<BR></BLOCKQUOTE></BODY></HTML>