Home » Developer & Programmer » Forms » How to kill EXCEL.exe from Task Manager from Oracle Forms?
How to kill EXCEL.exe from Task Manager from Oracle Forms? [message #264739] Tue, 04 September 2007 06:57 Go to next message
bbaz
Messages: 138
Registered: April 2007
Senior Member
I am continuously Opening and Closing and Excel Sheet in order to get specific data into my Oracle Form.

Surprisingly, I found out that whenever I am calling my procedure and running the code, an instance of EXCEL.EXE task is created in the TASK MANAGER and is not being killed/ended when I close and Quit Excel which will end up in a Memory Leakage. (If I call the excel sheet 10 times, I get 10 instances)

How can I Kill the Excel.exe after I close the Excel Sheet?

currently I am closing excel as follows:

ole2.release_obj(worksheet); 
ole2.release_obj(worksheets);
ole2.release_obj(workbook); 
ole2.release_obj(workbooks); 
ole2.invoke(application,'Quit'); 
ole2.release_obj(application);


Thanks in Advance,
Baz
Re: How to kill EXCEL.exe from Task Manager from Oracle Forms? [message #264774 is a reply to message #264739] Tue, 04 September 2007 09:46 Go to previous messageGo to next message
sanka_yanka
Messages: 184
Registered: October 2005
Location: Kolkata
Senior Member

Quote:
ole2.release_obj(worksheet);
ole2.release_obj(worksheets);
ole2.release_obj(workbook);
ole2.release_obj(workbooks);
ole2.invoke(application,'Quit');
ole2.release_obj(application);



In your code somehow this bit of code is not running, so the excel application was remain alive after execution of the code. Debug the code or otherwise post to code to check by DBA's in this forum.

Cheers
Sanka
Re: How to kill EXCEL.exe from Task Manager from Oracle Forms? [message #264781 is a reply to message #264774] Tue, 04 September 2007 10:18 Go to previous messageGo to next message
bbaz
Messages: 138
Registered: April 2007
Senior Member
Thanks Sanka,

I appreciate your help. Well yes, you seem to be right about this as I have commented the line out (ole2.invoke) and still it is not making any difference.

So why is it that the:
ole2.invoke(application,'Quit');


is NOT QUITING THE EXCEL APPLICATION???

Can someone shed some light on this?

Thanks to all,
Baz
Re: How to kill EXCEL.exe from Task Manager from Oracle Forms? [message #264793 is a reply to message #264781] Tue, 04 September 2007 10:44 Go to previous messageGo to next message
bbaz
Messages: 138
Registered: April 2007
Senior Member
All,

As per the following link from ORACLE website:

http://www.oracle.com/technology/products/forms/htdocs/webutil/howto_ole.html

I am using a similar sequence of releasing the Objects and Quiting the Application.

Why is it that it is failing to END THE EXCEL.EXE Process in my code?

Thanks in advance
Re: How to kill EXCEL.exe from Task Manager from Oracle Forms? [message #265042 is a reply to message #264793] Wed, 05 September 2007 05:33 Go to previous messageGo to next message
bbaz
Messages: 138
Registered: April 2007
Senior Member
Mad Mad Mad

This is driving me crazy.
When I am closing as per the code below:
OLE2.INVOKE(workbook, 'Save');
ole2.invoke(workbooks,'close');
pause;
ole2.invoke(applic,'Quit');


The Active Workbook is Saving Automatically, All the Workbooks are Closing Properly, I am pausing to Make sure all are closed, AND WHEN I "QUIT" EXCEL WINDOW IS SHUT DOWN BUT THE EXCEL.EXE process is still running in the background!!!!!

HOW CAN I FORCE KILL IT? Can I write a similar code similar to the VB code below:
Dim objProsses As Process() = Process.GetProcesses
        Dim intCount As Integer
        For intCount = 0 To objProsses.Length - 1
            If objProsses(intCount).ProcessName.ToUpper = "EXCEL.EXE" Then
                objProsses(intCount).Kill()
            End If
        Next



I hope that someone will give me a hand on this as I am running out of time!!!

Re: How to kill EXCEL.exe from Task Manager from Oracle Forms? [message #266173 is a reply to message #265042] Mon, 10 September 2007 01:49 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
What version of Forms and windows are you using?

David
Re: How to kill EXCEL.exe from Task Manager from Oracle Forms? [message #266249 is a reply to message #266173] Mon, 10 September 2007 05:02 Go to previous messageGo to next message
bbaz
Messages: 138
Registered: April 2007
Senior Member
Hi David,

I am using: Oracle FORMS Version 9.0.2.9.0
O/S: Windows XP

Thanks in advance,
Baz
icon14.gif  Re: How to kill EXCEL.exe from Task Manager from Oracle Forms? [message #266575 is a reply to message #266249] Tue, 11 September 2007 02:55 Go to previous message
bbaz
Messages: 138
Registered: April 2007
Senior Member
FINALLY, I GOT THIS RESOLVED Cool

I hope that Others will benefit from this Post later.

From the researches I made, I found out that the EXCEL.EXE process will stay RUNNING in the Task Manager as long as there STILL EXISTS A LIVING OLE2 Object that has not been RELEASED.

In my case, although I verified like 100 times that all the OLE2 Objects I was Creating I was RELEASING at the END before QUITING the Excel Application but still this did not resolve the problem and I was always facing a Memory Leakage and the Excel.exe was still running in the background; and everytime I call my Form to Connect to Excel and get Data a New EXCEL.exe Process Instance is created in the Task Manager.

Related to this Issue, and what solved my problem is NOT USING the OLE2 OBJECT "worksheets" (note the S, worksheetS) AND I changed the EXCEL initialization and File Opening Code as follows:

-- Initialize Excel and Open the PI-Datalink Sheet (Tanks,Tags)

applic := OLE2.CREATE_OBJ('Excel.Application'); 
ole2.set_property(applic,'Visible','true'); 
workbooks := OLE2.GET_OBJ_PROPERTY(applic, 'Workbooks'); 
args := OLE2.CREATE_ARGLIST; 
ole2.add_arg(args,'c:\oratopi.xls'); 
workbook := ole2.GET_OBJ_PROPERTY(workbooks,'Open',args); 
ole2.destroy_arglist(args);

--worksheets := ole2.GET_OBJ_PROPERTY(workbook, 'Worksheets'); 

--Message('opening Worksheet and Initializing');
--worksheet := OLE2.GET_OBJ_PROPERTY(applic,'activesheet');
--OLE2.SET_PROPERTY(worksheet , 'Value','Sheet1');

args := OLE2.CREATE_ARGLIST; 
OLE2.ADD_ARG(args, 'Sheet1'); 
worksheet:=OLE2.GET_OBJ_PROPERTY(workbook,'Worksheets',args);

OLE2.DESTROY_ARGLIST(args);




NOTE the Statements COMMENTED OUT.

The following link was very helpful:
http://forums.oracle.com/forums/thread.jspa?threadID=224129&tstart=-1

Thanks to all who tried to help.

Cheers,
Baz



Previous Topic: running report from form
Next Topic: Can I dynamic change the canvas in a window?
Goto Forum:
  


Current Time: Thu Dec 26 14:40:32 CST 2024