2

I currently have a dll containing a TForm descendant that gets displayed when an exported function is called. The client applications have varying release cycles so this minimizes unnecessary changes to them when the dll has to change. There are well known problems with this approach stemming from dll and client apps having different instances of TApplication so I won't elaborate further. BPLs are the recommended solution to this problem but aren't currently an option because the client applications are compiled in different versions of Delphi (and I'd like to keep the option open for reuse in a few non-delphi applications as well).

To avoid these problems I am attempting to replace the dll with an ocx containing a self contained Active Form control that can be displayed in the client applications by dropping it onto a form either in a TOleContainer or as a wrapped control.

Using the documentation and some tutorials I created an ocx project, active form and registered it. I then set about getting it into a test application. I had no problem getting the control to display in a TOleContainer but it wouldn't respond to mouse or keyboard actions. I thought it might be a limitation of TOleContainer so I imported the ocx using "Import Component" and dropped the resulting VCL component wrapper onto my form. Same result. No response to any mouse or keyboard actions. (With the exception that right-clicking the control displays a "Properties" context menu)

I've read and reread the documentation and tutorials and don't see that I've missed any steps. According to them it "just works". I'm sure there is something I'm missing.

Kenneth Cochran
  • 11,954
  • 3
  • 52
  • 117
  • There is no real problem having a form in a DLL, without runtime packages. I do it frequently. The DLL should only export Windows common data types and "flat" functions or interfaces having arguments and return values of similar common data types. Are allowed Integer, Char, PChar, Bool, Byte, and similar. Do NOT use any dynamic data type sucha as class instance, long string, dynamic array and similar. records are allowed provided they contain only common data types. – fpiette Aug 08 '13 at 18:19
  • 1
    The problems I'm referring to are mostly to do with UI integeration. [Hints not working](http://stackoverflow.com/q/2280240/71200), [Hidden forms](http://stackoverflow.com/q/1639125/71200), etc. Lots of things just don't work as expected. If you have solutions for all these problems I would consider that an acceptable answer as well. Of course I'm not sure using an Active Form will side step these problems either. – Kenneth Cochran Aug 08 '13 at 18:36
  • Can you post a very short demo of the thing(s) that doesn't work for you ? Both the DLL project and the host application. Keep it as small as possible, just bug enough to reproduce the issue, nothing more. Only source code ready to build. I don't promize anything, but if I can reproduce the issue within 5 minutes, I'll have a look at your code. – fpiette Aug 12 '13 at 19:16

0 Answers0