• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

11. Windows APIs > 11.6. Exit Windows Under Program Control

11.6. Exit Windows Under Program Control

Problem

You’d like to be able to control what happens once you quit your applications: you may want to shut down Windows at the same time, or perhaps even reboot the machine. How can you do that from within Access?

Solution

The Windows API provides an ExitWindowsEx function that grants you control over exiting Windows, and you have a choice of three different things you can do: log off and await a new login; shut down to the point at which it’s safe to turn off the computer’s power; or reboot the computer. This solution demonstrates these simple functions.

To try closing Windows under program control, load and run frmExitWindows from 11-06.MDB. This sample form, shown in Figure 11-7, allows you to choose from the three options. Make your choice and click on the Go button, which will execute the code necessary to quit in the manner you’ve specified.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint