After a bit of searching through MSDN help, I found the SetThreadExecutionState command in the kernel32.lib. If you invoke SetThreadExecutionState(&H80000001) on entry to your application, you will prevent the OS from entering standby autonomously from an idle state. A user initiated standby, though, will override this. The application should issue a SetThreadExecutionState(&H80000000) on close to ensure for good housekeeping.
If you want the system to query the user before entering a user-initiated standby, then your application needs to intercept and respond to the WM_PowerBroadcst message fired by the PBT_APMQuerySuspend event. You will need to subclass your main application and respond to the event by returning a BROADCAST_QUERY_DENY from the wind
ow message loop. Go to this URL for the relevant code fragment in VB: http://www.freevbcode.com/ShowCode.asp?ID=2596
Larry E."