Announcement

Collapse
No announcement yet.

Suspend Mode Message?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Suspend Mode Message?

    I am writing a TCP/IP Server and I noticed that whenever windows goes
    to sleep (suspend mode) that I am unable to attach to the server, even
    if the machine is resumed back to normal mode. It seems as if the socket
    that I am listening on has been dis-continued. Is there any way in the
    main dialog proc to know that windows is about to go into suspend mode?
    Can you also tell when the system is back to normal? Any ideas or work-
    arounds for this?


    Thanks

    Scott

    P.S. This is with Windows 98, I haven't tested this on Win 2K yet.


    ------------------
    Scott Slater
    Summit Computer Networks, Inc.
    www.summitcn.com

  • #2
    Code:
    WM_POWERBROADCAST
    dwPowerEvent = (DWORD) wParam;
    dwData = (DWORD) lParam; 
    
    The WM_POWERBROADCAST message is sent to an application to
    notify it of power-management events.
    Windows NT: For Windows NT applications, use WM_POWER.
    
    Parameters
    
    dwPowerEvent
    
    Event notification message. This parameter can be one of the 
    following values:
    
    Value	Meaning
    PBT_APMBATTERYLOW	Battery power is low.
    PBT_APMOEMEVENT	OEM-defined event occurred.
    PBT_APMPOWERSTATUSCHANGED	Power status has changed.
    PBT_APMQUERYSTANDBY	Request for permission to standby.
    PBT_APMQUERYSTANDBYFAILED	Standby request denied.
    PBT_APMQUERYSUSPEND	Request for permission to suspend.
    PBT_APMQUERYSUSPENDFAILED	Suspension request denied.
    PBT_APMRESUMECRITICAL	Operation resuming after critical suspension.
    PBT_APMRESUMESTANDBY	Operation resuming after standby.
    PBT_APMRESUMESUSPEND	Operation resuming after suspension.
    PBT_APMSTANDBY	System is changing to standby.
    PBT_APMSUSPEND	System is suspending operation.
    
    dwData
    
    Function-specific data. For most messages, this parameter is 
    reserved and not used. 
    However, if wParam is one of the resume notifications 
    (PBT_APMRESUME*), the lParam parameter can specify the
     PBTF_APMRESUMEFROMFAILURE flag. This flag indicates that a 
    suspend or standby operation failed after the PBT_APMSUSPEND or 
    PBT_APMSTANDBY message was sent.
    
    Return Value
    
    Returns TRUE if successful or FALSE otherwise.
    I think, you are searching for this:
    Code:
    PBT_APMRESUMESUSPEND	Operation resuming after suspension.
    PBT_APMSUSPEND	System is suspending operation.
    And look at the bold part. Other message for WinNT/2K(!)

    ------------------
    E-Mail (home): mailto:[email protected][email protected]</A>
    E-Mail (work): mailto:[email protected][email protected]</A>

    [This message has been edited by Sven Blumenstein (edited July 04, 2001).]

    Comment


    • #3
      Thank you very much! I'll give that a try. That looks exactly like
      what I need.


      Scott

      ------------------
      Scott Slater
      Summit Computer Networks, Inc.
      www.summitcn.com

      Comment


      • #4
        I have the latest Win32Api.Inc (July, 02) and can't seem to find the
        values for the %PBT_xxxxx equates. Also I am looking for the value
        to %BROADCAST_QUERY_DENY. Anyone have any of these values?


        Thanks

        Scott Slater

        ------------------
        Scott Slater
        Summit Computer Networks, Inc.
        www.summitcn.com

        Comment


        • #5
          Code:
          PBT_APMQUERYSUSPEND = &H0
          PBT_APMQUERYSTANDBY = &H1
          PBT_APMQUERYSUSPENDFAILED = &H2
          PBT_APMQUERYSTANDBYFAILED = &H3
          PBT_APMSUSPEND = &H4
          PBT_APMSTANDBY = &H5
          PBT_APMRESUMECRITICAL = &H6
          PBT_APMRESUMESUSPEND = &H7
          PBT_APMRESUMESTANDBY = &H8
          BROADCAST_QUERY_DENY = &H424D5144 'Win9x/ME
          PWR_FAIL = -1 'WinNT/2k
          ------------------
          E-Mail (home): mailto:[email protected][email protected]</A>
          E-Mail (work): mailto:[email protected][email protected]</A>

          [This message has been edited by Sven Blumenstein (edited July 05, 2001).]

          Comment

          Working...
          X