Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I Initiate MS Windows Shutdown With PB Script 1

Status
Not open for further replies.

Tentacle

Programmer
Nov 10, 2000
34
0
0
ZA
Hi all. I’m using PB 6.5 at the moment and have an application I wrote that need to shutdown Microsoft windows when I click the close button on my application. Does anyone know how to have windows shutdown automatically without asking the user whether they want to or not after clicking a button in my PB app. I suppose I could always call an .exe file that does that from PowerBuilder but hoped there would be some other direct way of doing this. Thanx in advance to anyone who can assist.

PS: The app is running on windows 95 and XP respectively.

Tentacle
 
Hi,

Have a look at
You'll need to code an external function declaration for this:
Code:
Function boolean ExitWindowsEx (Long dwOptions, Long dwReserved) Library "user32" Alias For "ExitWindowsEx" (from thread144-505324)

The variable dwReserved is used in XP (see the link). You may find that you are better off using the
Code:
InitiateSystemShutdown
or
Code:
InitiateSystemShutdownEx
since ExitWindowsEx can succeed even if some other process subsequently stops the shutdown.

Cheers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top