Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8079745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:12:28+00:00 2026-06-05T16:12:28+00:00

I have several Delphi programs that maintain connections to a database (some Oracle, some

  • 0

I have several Delphi programs that maintain connections to a database (some Oracle, some Firebird.) If the program are running while Windows goes into sleep mode the connection to the database is lost. What’s the best way to handle this situation? Is there some way to receive an event before the network goes into sleep mode so I can attempt to handle the situation better?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T16:12:30+00:00Added an answer on June 5, 2026 at 4:12 pm

    To elaborate on RRUZ, you want something like:

    procedure WMPowerBroadcast(var AMessage: TMessage); message WM_POWERBROADCAST;
    

    in your form. Then WMPowerBroadcast will be something like:

    procedure TMyForm.WMPowerBroadcast(var AMessage: TMessage);
    const
      PBT_APMSUSPEND = 4;
      PBT_APMRESUMESUSPEND = 7;
    begin
      case AMessage.WParam of
        PBT_APMSUSPEND:
        begin
          // save your DB stuff. NOTE: IIRC you are pretty limited in the time 
          // you get to do this - 2 seconds ? may be the limit
        end;
        PBT_APMRESUMESUSPEND:
        begin
          // restore your DB connection
        end;
      else
         // you're going to want to handle PBT_APMRESUMECRITICAL (XP and older systems) and PBT_APMRESUMEAUTOMATIC differently
         // IIRC you did not get notification of the suspend in this case
      end;
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have Windows Server 2008 R2 Machine that is running a Delphi 2007 application.
I have written a console application in Delphi that queries information from several locations.
I have an application that called several other .exe components written in delphi. The
My program have several worker threads that calling a function in a dynamically loaded
We have some legacy code that compiles in Delphi 6. There are plans to
I am using Delphi 2010 to create a Windows service that will monitor several
I have a Delphi 2007 TRichEdit with several lines in it. I want to
We have a legacy 3rd party program that is failing with the error Class
I have a Delphi 6 app that makes movies from an incoming video and
my delphi 2009 app uses a DLL that performs some activities that may take

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.