Get the windows Process ID of current opened Application

13 views
Skip to first unread message

ludovi...@gmail.com

unread,
Jan 22, 2018, 4:42:00 PM1/22/18
to JExcel Forum
Hi

After creating an Application

com.jniwrapper.win32.jexcel.Application application = new com.jniwrapper.win32.jexcel.Application.Application();



Is there a way to obtain the processID (PID)  displayed in Windows Task Manager ?

If not, is there a way to set manually a description in the description column ?


process.png

Anna Dolbina

unread,
Jan 23, 2018, 6:32:26 AM1/23/18
to Ludo, JExcel Forum
Hi,

Unfortunately, there is no reliable approach provided by the Excel object model to determine the corresponding process ID.
Could you please provide a more detailed description of your use-case?
In general, it is possible to obtain the Application.Hwnd and Application.Hinstance values that can be used for some low-level tasks.

Sincerely,
Anna



--
You received this message because you are subscribed to the Google Groups "JExcel Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jexcel-forum+unsubscribe@teamdev.com.
To view this discussion on the web visit https://groups.google.com/a/teamdev.com/d/msgid/jexcel-forum/5d0f08c6-a49b-4f08-9b3a-13ba8baabd77%40teamdev.com.

ludovi...@gmail.com

unread,
Jan 24, 2018, 10:26:39 AM1/24/18
to JExcel Forum, ludovi...@gmail.com
Hi Anna,

Sometime, Excel process are not closed because, we create a lot of excel files and I would like to put in the log which process ID for which report, it would make it easier to find which report is responsible of this and to reproduce it.



On Tuesday, January 23, 2018 at 6:32:26 AM UTC-5, Anna Dolbina wrote:
Hi,

Unfortunately, there is no reliable approach provided by the Excel object model to determine the corresponding process ID.
Could you please provide a more detailed description of your use-case?
In general, it is possible to obtain the Application.Hwnd and Application.Hinstance values that can be used for some low-level tasks.

Sincerely,
Anna



On Mon, Jan 22, 2018 at 11:41 PM, <ludovi...@gmail.com> wrote:
Hi

After creating an Application

com.jniwrapper.win32.jexcel.Application application = new com.jniwrapper.win32.jexcel.Application.Application();



Is there a way to obtain the processID (PID)  displayed in Windows Task Manager ?

If not, is there a way to set manually a description in the description column ?


--
You received this message because you are subscribed to the Google Groups "JExcel Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jexcel-forum...@teamdev.com.

Anna Dolbina

unread,
Jan 25, 2018, 9:55:38 AM1/25/18
to Ludo, JExcel Forum
Hi,

Is it correct that the Excel processes you have mentioned were started when your application created the com.jniwrapper.win32.jexcel.Application instances for generating the reports?
If this assumption is correct, could you please specify how does your application close the unnecessary Application instances?

Sincerely,
Anna

To unsubscribe from this group and stop receiving emails from it, send an email to jexcel-forum+unsubscribe@teamdev.com.
To view this discussion on the web visit https://groups.google.com/a/teamdev.com/d/msgid/jexcel-forum/ba19400a-dbf5-4412-803d-301d0cb5a331%40teamdev.com.

ludovi...@gmail.com

unread,
Feb 5, 2018, 11:56:01 AM2/5/18
to JExcel Forum
Hi Anna,

Yes, it is correct. When the application create the jexcel.Application() , the Excel process is created, then closing the jexcel.Application(), the process is closing as usual.

Between these 2 actions, something on our side could be blocked for a long time and when it is happening, we see the process staying in the process list.  If we could log the processID, it would be easy for us to find and reproduce the problem.

Thanks

Ludo


Sincerely,
Anna

Anna Dolbina

unread,
Feb 6, 2018, 9:10:19 AM2/6/18
to Ludo, JExcel Forum
Hi Ludo,

Thanks for clarification!

For debugging purposes, you can consider obtaining a list of the EXCEL.EXE processes before and after creating an Application instance. The difference between these lists will allow you to determine the EXCEL.EXE process created when initializing a particular Application. You can also perform the same when closing the application to see if the process was terminated.

There are several approaches that can be used for obtaining the list of the running processes. For example, you can use Process.getProcesses() WinPack functionality or call Runtime.getRuntime().exec("tasklist.exe /fo csv /nh") and analyze the output of the corresponding process.

In addition, the Application class has the close(boolean forceQuit) method overload that calls Application.Quit method during shutdown. You can consider using this overload instead of the close() method if your application is not using it yet.

Please let us know if you have any further questions.



Sincerely,
Anna


To unsubscribe from this group and stop receiving emails from it, send an email to jexcel-forum+unsubscribe@teamdev.com.
To view this discussion on the web visit https://groups.google.com/a/teamdev.com/d/msgid/jexcel-forum/ad37786c-da12-4c52-adbc-68dbbb06bde6%40teamdev.com.

Reply all
Reply to author
Forward
0 new messages