there are lots of resources and solutions out there on the internet that are specific to this problem, however, in using the businessskinform components, that are tightly integrated with the vcl and messaging, i came across a few problems with the standard approaches.
the main problem with storing forms in dlls and being able to create instances of them from within a host exe is that when delphi compiles up a dll, it has its own tapplication and tscreen instances (as well as other info as to be discovered). 【程序编程相关:systemparametersinfo】
the final solution came with the assistance of steve woods (aka reconics). 【推荐阅读:ShadowStar CodeFast 】
so how do we coax the form in the dll to think it is part of the exe, we replace the application and screen object in the dll with the reference to the exes application and screen. 【扩展信息:试卷自动生成系统的开发与应用】
this means that the dll and the exe message loops are different, the rtti information is different, and causes lots of problems like the well know "cannot assign a tfont to a tfont" message.
this is a standard approach that you will find on the net. however there is one additional element that needs to be passed from exe to dll and this is the tricky one.
from steve woods -
“the problem is caused by the controlatom local variable in the controls.pas units. when the controls unit initializes it creates a global atom based on the string controlofs + the hinstance and thread id of the application and stores the atom in the controlatom local variable. ... 下一页