I'd like to save the state of my machine before shutdown (for machines that do not support hibernate).
Essentially, I'm trying to mimic the Windows Hibernate feature. When the machine its turned back on, it looks exactly like it did previous to being shut down.
Any ideas on using managed code to perform this task?
Currently using/co...
I've got a program that's having some trouble during shutdown, raising exceptions that I can't trace back to their source. It appears to be timing-related and non-deterministic. This is occurring after all shared resources have been released, and since it's shutdown, memory leaks are not an issue, so that makes me wonder if there's any...
Under POSIX OS there is signal API that allows to send a signal to process to shut it down
with kill and you can catch it with sigaction and do what you need;
However, Win32 is not POSIX system, so:
How can I handle shutdown events that may come, for example from "End Process" in "Task manager"?
What is the standard API for sending sh...
I have a small program which simply reads a diary text file and displays it in a memo - thats it - no buttons you double click on the form to shut it down if you want it to disappear. When it has been run (even if you close it) windows XP gets as far as "Windows is shutting down" ie. after "Saving User Settings" etc and then it hangs. ...
Is there any tool to send (mimic) a windows message like 'WM_ENDSESSION' to a windows service?
OR
How can I send a windows message to a process using C#?
(I know only C#)
EDIT: Purpose: Basically I have to debug a windows service for fixing a bug that occurs only on system shut down.
...
I have a VB6 application that uses several components written in .net. The application must shutdown gracefully when windows is shut down. The problem is that if the .net part of the code is displaying a window, the application displays the message "Cannot Quit" and fails to exit. (It is then terminated by the OS)
I've managed to reprod...
There are different ways of shutting down a computer remotely.
Here are three I know of:
Invoking the Shutdown method of the Win32_OperatingSystem class through a remote WMI connection
Using the Microsoft Windows shutdown.exe
Letting your (whatever).exe copy itself to the systemfolder on the target machine, register itself as a servic...
Hi,
is it possible to get shutdown reason in Windows Server 2008 immediately after user choose the reason in dialog window? For the shutdown event i'm using SystemEvents.SessionEnding..
I want to write windows service, which will send e-mail about this event.
Or is there any other way in windows server to send e-mails about shutdown/re...
I'm writing an application in C for the Mac (Leopard) that needs to do some work on receipt of power notifications, e.g. sleep, wake-up, shutdown, restart. It runs via launchd as a launchagent on login then begins monitoring for notifications. The code I'm using to do this is as follows:
/* ask for power notifications */
static void Sta...
i want to prevent users from shut down or restart the system. my application runs as a Win32 Native Service (written by C++) and under LocalSystem account.
i heard about WM_QUERYENDSESSION it's solution: creating a hidden window and capturing WM_QUERYENDSESSION to prevent shutdown.
but this solution is not really clean and also have t...
Hi,
I would like to determine the exit status of the process during the shutdown hook runtime.
I want to have a logic which is based on the status code (0 or nonzero)
(ex: if zero do nothing else nonzero send an alert email)
Do you know how I can get this information?
...
Unlike Windows Vista, when Windows XP is shutting down - it doesn't tell you which program is requesting not to be shutdown. This leaves Windows still running and not telling you what program is preventing shutdown.
As I understand it, Windows sends WM_QUERYENDSESSION to all applications. If any of the applications return 0 to the funct...
I have an init servlet in Tomcat that loads critical data. soemtimes it is necessary to abort startup on certain errors.
how do i gracefully shutdown the deployed app/ the whole app server without calling System.exit(1)
i want to avoid calling the shutdown servlet via port, since this is not configured in my installation.
there may b...
I need to save some data preferrably when the java web application is stopped, or when tomcat is stopped. how can this be done?
Edit:
any drawback if I use the jvm shutdown hook?
...
Hi, I have an application that spawns worker threads and process files in the the worker threads. On application shutdown request, I want the application to shutdown only when the worker thread has finished processing the current file (if it is processing a file). I am using JavaServiceWarapper to manage my application.
I have added shu...
Is there a way to find out when the system was last shutdown?
I know there's a way to find out last boot up time using the LastBootUpTime property in Win32_OperatingSystem namespace using WMI.
Is there anything similar to find out last shutdown time?
Thanks.
...
Windows XP/VISTA/7
How might it be possible to run an application during the logoff procedure of a user, after explorer.exe terminates?
The purpose is to block shutdown but with an application that runs after explorer has terminated.
It is of course possible to temporararily block shutdown in vista with ShutdownBlockReasonCreate, or t...
I am attempting to show a form from a service on Vista (using .NET winforms)
Obviously the form would not show to the console user, as services are isolated in session 0.
However the experiment is to see if it is possible to "show" an invisible form and obtain a window handle & message loop
I have tried but when I issue form.Show(), o...
Create a form (I'm using .NET 2.0) with a button click event:
{
Thread.Sleep(3000);
ExitWindowsEx(0,0); // shutdown
}
Hit the button, press Left-WindowsKey + L to lock the desktop. The shutdown fails.
ExitWindowsEx returns 1 (Success).
I would like to know why this API fails and what else might fail when the desktop is locked?
...
When updates are available and the user selects Shut Down from the Windows start menu, a dialog appears with a menu for Shutdown, Log Off etc.
One option which appears is
"Install Updates And Shut Down"
The question is, what exactly happens when the user presses OK?
Is the task showing the dialog Explorer? (It seems impossible to tel...