| |
t e m p o r a l |
d o o r w a y |
|||||||||
Forms In DLLs |
|||||||||||
|
One of the most common questions to arise is "How can I use a form in a DLL"? This document answers that question. Essentially, there is no real difference between this and using a data module in a DLL. Indeed, one can use multiple forms and data modules in a DLL by combining the techniques shown in these two documents. As mentioned, if a form is to be instantiated only once for the life of the DLL, it should be created in the DllEntryPoint function, which is called each time the DLL is attached to a process. To prevent the form from being created more than once, a check of the data module global pointer is made. If it is is NULL, then the form has not been instantiated. Alternatively, you can consider the strategy that uses a static boolean to mark the first call to the process attach. The following shows the DLL code. You'll notice there isn't much to it...
As you can see, this is very simple stuff, with no big surprises. When you invoke the function it shows the dialog modally and returns what you type. The main program is essentially identical to the one in the original DLL article. So there you go - it's about as simple as it can be. |
|||||||||||
|
Copyright © 2004 by Mark
Cashman (unless otherwise indicated), All Rights Reserved
|