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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

shutdown Windows via API (Power 5)

Status
Not open for further replies.

Joseh

Programmer
Aug 12, 2001
6
AR
Hello,
I have been working a little calling API Windows functions (Gianni know) and now i can contribute with this simple example to shutdown (turn off) the computer from PowerCOBOL.
For this, first you need to add the USER32.LIB to your ppj and the ALPHAL(WORD) directive to the compiler, then in an event (ie the click event of a command button) simply put this code:
Code:
WORKING-STORAGE SECTION.
 01 RETCODE PIC S9(9) COMP-5 VALUE 0.
PROCEDURE DIVISION.
    CALL "ExitWindowsEx" WITH STDCALL LINKAGE
                         USING BY VALUE 5
                         BY VALUE 0
                         RETURNING RETCODE
That's all! When you click on your command button, your PC shutdown and turn off. Tested with: Win95,98 and Millenium. If work in other versions, please let me know. Thanks!
Saludos!
Jose Holzmann
 
Hi Jose

Very Good!!
You are becoming a wizard....as me!! :)

Gianni
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top