LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

EXCEL.EXE process is keep running even after closing all the handles

Solved!
Go to solution

If you are running an older version of LabWindows (like I am, v6.0) then you won't be able to track your resources. You will have to be very very very thorough in closing all handles, it is rather difficult sometimes, and buggy. http://forums.ni.com/t5/LabWindows-CVI/excel-memory-leaks-in-CVI/m-p/1290282

0 Kudos
Message 11 of 14
(6,976 Views)

One more clue: be aware of the global object handles!

 

Caution must be taken when using global object handles declared in front of the main() funciton.

They must be cleared up properly, such as the ClearObjHandle() function in the example code excel2000dem.c, before re-assigning new values to them.  Otherwise, the EXCEL.EXE won't quit, either.

0 Kudos
Message 12 of 14
(6,964 Views)
Solution
Accepted by topic author a kumar

One additional clue.

Some object may be left pending if you happen to reuse a single variable to handle various objects one after the other: if you don't dispose of an object before you reuse the variable, it will remain in memory and prevent excel from closing properly. Disposing of the last object won't close all previous ones!



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 13 of 14
(6,955 Views)

Robert's post above was the problem I chased for a day in my code as well.

I had inadvertently redefined (reused) an ExcelObj_Worksheet handle variable twice. I was using it to access the same worksheet, but I had accidently called Excel_SheetsItem () more than once (a leftover from early code work). When you do that, another set of Excel resources are allocated each time, even though you only have the one declared object variable.

If you later use CA_DiscardObjHandle() on the object variable to clear it out, you're only clearing the Excel resources for the last time it was defined, not all the times. I got rid of the inadvertent second Excel_SheetsItem () call, Excel now shuts down properly in the Task Manager. Ahhhh...

0 Kudos
Message 14 of 14
(3,025 Views)