| vbAccelerator - Contents of code file: frmQueryEndSession.frmThis file is part of the download VB5 Query End Session Sample, which is described in the article Preventing Logoff or Shutdown. VERSION 5.00
Begin VB.Form frmQueryEndSession
Caption = "Responding to End Session Messages"
ClientHeight = 3600
ClientLeft = 4215
ClientTop = 3150
ClientWidth = 5490
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Icon = "frmQueryEndSession.frx":0000
LinkTopic = "Form1"
ScaleHeight = 3600
ScaleWidth = 5490
Begin VB.ListBox lstEvents
Height = 2400
Left = 240
TabIndex = 1
Top = 840
Width = 4995
End
Begin VB.CheckBox chkAllowEndSession
Caption = "chkAllowEndSession"
Height = 255
Left = 300
TabIndex = 0
Top = 240
Width = 4875
End
End
Attribute VB_Name = "frmQueryEndSession"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Const WM_QUERYENDSESSION = &H11
Private Const ENDSESSION_LOGOFF = &H80000000
Implements ISubclass
Private Sub Form_Load()
AttachMessage Me, Me.hWnd, WM_QUERYENDSESSION
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
DetachMessage Me, Me.hWnd, WM_QUERYENDSESSION
End Sub
Private Property Let ISubclass_MsgResponse(ByVal RHS As SSubTimer.EMsgResponse)
'
End Property
Private Property Get ISubclass_MsgResponse() As SSubTimer.EMsgResponse
ISubclass_MsgResponse = emrPreprocess
End Property
Private Function ISubclass_WindowProc(ByVal hWnd As Long, ByVal iMsg As Long,
ByVal wParam As Long, ByVal lParam As Long) As Long
Dim sMsg As String
Dim lR As Long
If (iMsg = WM_QUERYENDSESSION) Then
If (lParam Or ENDSESSION_LOGOFF) = ENDSESSION_LOGOFF Then
sMsg = "Log off request received"
Else
sMsg = "Shutdown request received"
End If
If (chkAllowEndSession.Value = vbChecked) Then
sMsg = sMsg & ", Accepted"
lR = 1
Else
sMsg = sMsg & ", Denied"
lR = 0
End If
lstEvents.AddItem sMsg
ISubclass_WindowProc = lR
End If
End Function
| |||
|
|
||||