how to close shell application?

  • Thread starter Thread starter Josu Zamarripa
  • Start date Start date
J

Josu Zamarripa

How can i close my shell applicaction and close (or restart ) the sistem
too?
When i only close my aplication, it always re-starts.

Now I'm trying calling ExitWindowsEx( EWX_SHUTDOWN, 0) and ExitWindowsEx(
EWX_REBOOT, 0) in my applicaction and capturing WM_QUERYENDSESSION message,
but i get access violation adress at ntdll.dll
It works with Xp prof .

Any idea please?

I'm using Delphi.
 
Josu,

You should look in the NG archive. This topic has been discussed many times
here and even with regards to Delphi Shell apps.
How can i close my shell applicaction and close (or restart ) the sistem too?
When i only close my aplication, it always re-starts.

Now I'm trying calling ExitWindowsEx( EWX_SHUTDOWN, 0) and
ExitWindowsEx(EWX_REBOOT, 0)

Either one, right?
You will need to adjust token first to set enough process privileges to do
the shutdown.
Check the code here
http://groups.google.com/[email protected]&rnum=2
It is C/C++ code but you can easily convert it to Delphi (Pascal).
in my applicaction and capturing WM_QUERYENDSESSION message,

Does your app actually do anything on WM_QUERYENDSESSION? Hope you return
TRUE from the message handler.
but i get access violation adress at ntdll.dll
It works with Xp prof .

Any idea please?

For you it would be easier to launch a command like
- "xpepm.exe -reboot" (include "Power Management Application"
component in to your image),
- or "shutdown -r" (include "Misc. Command Line Tools"
component),
- or even "fba.exe -reboot" with the fba working directory.
I'm using Delphi.

KM
 
Thankssss... KM... I set the privileges and return TRUE from the message
handler.

I'll try with xpepm.exe -reboot and shutdown -r... Thanks very much...

Anyway what means NG archive?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top