06-24-2010 12:14 PM
Hello
I have a C# application that allows the user to open multiple MDI windows. Each MDI window is an empty parent window for a LabVIEW DLL where the controls and front panel (form) is defined in the main VI of the LabVIEW DLL. Each MDI window opens the LabVIEW main VI on a new thread. If I open four MDI / LabVIEW windows of the same LabVIEW main VI and close them in the reverse order in which they were opened, then everything seems to shut down properly. However, if I open four MDI / LabVIEW windows of the same LabVIEW main VI and close the one that was opened first, then the first window shuts down properly, but the fourth one opened closes only the LabVIEW portion of the window (the child of the MDI) and leaves the C# MDI empty parent window still visible. The LabVIEW DLL is both reentrant (in the VI properties) and AllowMultipleInstances = TRUE (in the .ini file).
So I was wondering if calling this VI in a LabVIEW DLL is truly a multiple instance (since two of my four instances were closed when I only clicked one Close box)?
Or, maybe there is something more I need to do in LabVIEW to be able to run a VI in a LabVIEW DLL as a separate instance each time it is called from C#?
06-25-2010 03:36 PM
Hi Sandeepvd,
Does this only happen when you open exactly 4 instances, or are you able to reproduce it in other ways as well? It sounds like you've covered your bases for reentrancy on the LabVIEW side, but take a look at this tutorial for building DLLs in LabVIEW as well as the related links for calling those DLLs externally.
06-25-2010 05:14 PM
This happens for 4 or more instances (windows).
If I close the first one, the last one looses it's labview DLL meat.
06-28-2010 07:02 PM
More descritption
I have a C# application that allows the user to open multiple MDI windows. Each MDI window is an empty parent window for a LabVIEW DLL where the controls and front panel (form) is defined in the main VI of the LabVIEW DLL. When the user closes the C# MDI parent window, I want to also close the child LabVIEW window. I have tried sending a WM_CLOSE message to the handle of the child window, but my LabVIEW DLL does not receive an “Application Instance Close?” event or a “Panel Close?” event. Is there an event that is fired by the LabVIEW VI when a C# application sends it a WM_CLOSE message? If so, what event should be handled in the VI’s event case structure? Or, if the WM_CLOSE message cannot be mapped into an event that is handled in an event case structure, how should it be handled? If there is not an event that is fired by the LabVIEW VI when a C# application sends it a WM_CLOSE message, then what should the C# application do to tell the LabVIEW DLL’s VI to close its front panel?
06-29-2010 02:54 PM
I'm not aware of event structures being able to directly handle Windows messages. However, there are tools available for download in the Developer Zone Tutorial: Windows Message Queue Library that will allow LabVIEW VIs to receive and process Windows messages. I hope this helps!
- Greg J
06-29-2010 07:09 PM
This does not help.
Windows WM_CLOSE , and Labview's Event structure are so fundamental.
There must be a way to receive MW_CLOSE inside LabVIEW event structure.
Please ?
07-02-2010 12:56 AM
Here's another forum that discusses the use of the message queue library for a similar purpose, but they also mention using the Application Exiting event. If that's not helpful, try taking a look at this KnowledgeBase: How Can I Close a Windows Application with LabVIEW ?
- Greg J