A Form in a vb.net DLL

May 12 2004 9:02 AM
I have a dll written in vb.net. The dll is a group of useful string and file functions/subs that, as a whole, are used as a plugin for a game authoring language, to help bolster that languages command set which is pretty weak when dealing with string and file manipulation. Having said that, the dll that is compiled from vb.net cannot be used directly as a plugin to the game authoring lang, so there is a wrapper dll written in C++ (by a friend) that basically acts as the go-between for my dll's logic and the game autoring language. Marshalling the data/returns back and forth. Still with me? Anyway, everything works wonderfully. The code in the game auth exe can call funtions in my dll, via the c++ wrapper, and everything is A_OK The problem is occurring where I decided to include some further functionality to the game coder by displaying some data to them on a standard winforms form that is instantiated via my dll. (the form is added as an item in the dll project, and has a listview on it) In my dll I made reference to the System.Windows.Forms.DLL and then added the matching imports statement for the namespaces. I have 3 methods to let the user deal with the form: 1)Instantiates the form and shows it, 2)Updates it's data(in a listview), and 3)Destroys the form. From a VB.NET test app which DOESN'T involve the game author lang, or the C++ wrapper, everything works as expected. The form is shown, the method that updates the data works fine, and the form can be closed at any time. All is fine. When we try to do the same test via the game exe >> c++ >> vb.net dll >> form we end up where the form gets created and displayed but we then lose all further "contact" with the form. No updates of data are displayed, and issuing a call to kill the form from the dll has no effect. If you then stop the game exe the form get's destroyed and disappears, I am assuming because the dll that owned has also been destroyed. Can anyone explain this to me? I know it's a strange scenario and I am sorry for the longwindedness but I wanted the picture to be accurate. Is this a threading issue of some sort? We receive no runtime exceptions, just lack of functionality. I have also experimented with making the form a global object when the dll is instanced, or making it's scope local to the methods trying to use it - both with no luck. Any insight into this issue would be GREATLY appreciated. Thank You, James