LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Excel leaves a ghost process in XP

Excel : Process is remaining resident in memory after I quit an application written in CVI 6.0.
The same happens using excel 2000 generator examples.

Run exceldemo2000 then
LaunchExcel,OpenFile,Read ,Quit.
I am using the report.fp but no embedded ActiveX.
I am just invoking
ExcelRpt_ApplicationNew
ExcelRpt_WorkbookOpen
ExcelRpt_WorkbookSave
ExcelRpt_WorkbookClose
ExcelRpt_ApplicationQuit

SAME EFFECT?



Thanks..
Download All
0 Kudos
Message 1 of 4
(2,963 Views)
I know it looks stupid answering myself but I might help someone else 🙂

I found that this piece of code seems to do the trick
if (WorkBookHandle)
CA_DiscardObjHandle(WorkBookHandle);


if (ExcelApplicationHandle)
CA_DiscardObjHandle(ExcelApplicationHandle);

Not sure if everything is solved .

But still don't he quit application et al take care of releasing the objects and handles ???
0 Kudos
Message 2 of 4
(2,963 Views)
Nope, for every handle you create (whether it be workbook, worksheet,etc.., with activex, you have to explicitly cleanup each handle by calling DiscardObjHandle. You'll see this if you check out the CVI examples that demonstrate using Excel ( or Word) as an automation server. You can find these examples under ..CVI\samples\activex.

Bilal Durrani
NI
Bilal Durrani
NI
0 Kudos
Message 3 of 4
(2,963 Views)
Thanks a lot !
is there a reason for the cleanup to be left optional ? since once the application is closed all handles (I suppose) should fall under the responsibility of the QuitApplication to clear the stack of objects (or will it be unaware of it ?)

p.s. you said DiscardObjHandle you mean CA_DiscardObjHandle or there's another cause I can't find it !

Thanks again and happy New Year To all of you at the NI support , thanks for the great service keep it up!!.
0 Kudos
Message 4 of 4
(2,963 Views)