How to detect when Windows is shutting down?

178 views
Skip to first unread message

Davide Perini

unread,
Feb 4, 2021, 4:07:15 PM2/4/21
to jna-...@googlegroups.com
Hi all,
is there a way to detect if windows is shutting down in order to close
my app before windows turn off the PC?

Probably a lame question, but I try :)

Thanks
Davide

Tres Finocchiaro

unread,
Feb 4, 2021, 4:12:41 PM2/4/21
to jna-...@googlegroups.com
David,

Hi, I've never done this, but perhaps this will help:


--
You received this message because you are subscribed to the Google Groups "Java Native Access" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jna-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jna-users/539d122b-9525-1edd-f293-0836787fcdc6%40dpsoftware.org.

Matthias Bläsing

unread,
Feb 4, 2021, 4:13:06 PM2/4/21
to jna-...@googlegroups.com
Hi,

Am Donnerstag, den 04.02.2021, 22:07 +0100 schrieb Davide Perini:
> is there a way to detect if windows is shutting down in order to close
> my app before windows turn off the PC?
>
> Probably a lame question, but I try :)

here is your google secretary speaking, I entered this query for you:

windows api shutdown java

Second hit leads me to:

https://www.codeproject.com/Tips/1257858/How-to-get-shutdown-event-in-windows-from-java-app

There a full sample using JNI, that should be adaptable to JNA.

Greetings

Matthias

Tres Finocchiaro

unread,
Feb 4, 2021, 4:19:04 PM2/4/21
to jna-...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "Java Native Access" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jna-users+...@googlegroups.com.

Václav Haisman

unread,
Feb 4, 2021, 4:27:48 PM2/4/21
to jna-...@googlegroups.com

Davide Perini

unread,
Feb 5, 2021, 4:07:22 AM2/5/21
to jna-...@googlegroups.com
Thank you all guys!

Davide
Reply all
Reply to author
Forward
0 new messages