codefinger
Programmer
VB 6.0 on W2000 computer:
I want to at least warn the user that a background process is not complete before allowing them to log off or restart the computer.
I have researched enough to come up with the following code:
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If UnloadMode = 1 Then
Exit Sub
Else
If MsgBox("Warning! Scans are being uploaded." + vbCrLf + _
"Logging off the computer will abort the upload." + vbCrLf +
vbCrLf + _
"Quit anyway?", vbOKCancel, App.ProductName) = vbOK Then
Exit Sub
Else
Cancel = True
End If
End If
End Sub
This comes close to doing what I want, but it is very messy. For one thing, a message box appears that just says "Cannot quit." I did not code that message, so it must be coming from the system. Also, the End Program dialog box comes up and blots out both the "Cannot quit" message box and my carefully worded text.
Does someone have a cleaner way for me to accomplish my objective, or a way to avoid these problems?
(The user is most likely to log off by clicking start/restart or start/logoff)
Thanks in advance for any kind assistance you can offer.
I want to at least warn the user that a background process is not complete before allowing them to log off or restart the computer.
I have researched enough to come up with the following code:
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If UnloadMode = 1 Then
Exit Sub
Else
If MsgBox("Warning! Scans are being uploaded." + vbCrLf + _
"Logging off the computer will abort the upload." + vbCrLf +
vbCrLf + _
"Quit anyway?", vbOKCancel, App.ProductName) = vbOK Then
Exit Sub
Else
Cancel = True
End If
End If
End Sub
This comes close to doing what I want, but it is very messy. For one thing, a message box appears that just says "Cannot quit." I did not code that message, so it must be coming from the system. Also, the End Program dialog box comes up and blots out both the "Cannot quit" message box and my carefully worded text.
Does someone have a cleaner way for me to accomplish my objective, or a way to avoid these problems?
(The user is most likely to log off by clicking start/restart or start/logoff)
Thanks in advance for any kind assistance you can offer.