in ModCom.bas is the important parts
Code:
Private lpPrevWndProc As Long
Private Const WM_COPYDATA = &H4A
Private Const GWL_WNDPROC = (-4)
Private Const SW_HIDE = 0
Private Const SW_NORMAL = 1
Private Const WM_POWERBROADCAST = &H218
Private Const PBT_APMSUSPEND = 4
Private Const PBT_APMRESUMESUSPEND = 7
Private Declare Function CallWindowProc Lib "user32" Alias _
"CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hwnd As _
Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As _
Long) As Long
'Process Window Events
Private Function WindowProc(ByVal hw As Long, ByVal uMsg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
Select Case uMsg
Case WM_COPYDATA 'If our function process data
Call ReceiveMsg(lParam)
Case WM_POWERBROADCAST 'System is asking about/entering/resuming from standby
If wParam = PBT_APMSUSPEND Then
PrepareForHibernate
End If
If wParam = PBT_APMRESUMESUSPEND Then
ResumeFromHibernate
End If
End Select
'If we're still hooked
If lpPrevWndProc <> 0 Then
' Call the original window procedure associated with this form.
WindowProc = CallWindowProc(lpPrevWndProc, hw, uMsg, wParam, lParam)
Else
WindowProc = 0
End If
End Function
So if you add ModCom.bas to your project just add PrepareForHibernate and ResumeFromHibernate Public Subs to your project