|
-
Jul 3rd, 2000, 04:47 AM
#1
Thread Starter
New Member
I have a little problem with one of my apps. On forms unload i want to save the current record. No problem with QueryUnload (calling a procedure to save it), but if the unload request comes from the system (shutdown, etc.) this special event (shutdown) stops! Now I'm looking for an indicator to restart this system request.
-
Jul 5th, 2000, 05:12 AM
#2
Hyperactive Member
Example
Here's some code I've used and it copes with system shutdown :
Code:
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
'********************************************************************************
Dim intReply As Integer
' bChanged just indicates that the user has changed some
' data so prompt for saving if that's true
If bChanged Then
intReply = MsgBox("Do you want to save your changes first ?", vbYesNo, "Task Manager ?")
If intReply = vbYes Then
Save_List
End If
End If
End
End Sub
You can check for the type of shutdown by checking the UnloadMode as follows :
Code:
If UnloadMode = vbAppWindows Then
.
.
.
End If
hope this helps.
That's Mr Mullet to you, you mulletless wonder.
-
Jul 5th, 2000, 08:37 AM
#3
Thread Starter
New Member
Re: Example
Paul, thanks for your answer,
... but the problem is, that the system request (for example "shutdown") STOPPS (!), when I save the record with my function! It stopps and the user must restart it, ... shutdown! What I want to know is the specific request to restart it by myself, in code. The constant "vbAppWindows" tell me only that the shell want to unload my app, but not why...(restart, shutdown,...???)
I hope you have any idea ...
Kristof
-
Jul 6th, 2000, 03:06 AM
#4
Hyperactive Member
subclassing
I've had a good look around to see if there's anything out there which might give you the answer but I the could not find the answer. However, subclassing seems to be one way forward. You can create your own winproc and intercept windows messages to your application. At shutdown the message recieved is WM_QUERYENDSESSION and from there you should be able to find out more information.
It's probably worth asking this question in C/C++ groups as it's something they might make use of more than VB users.
Sorry I can't be of any more help but if you find an answer can you post it because it would be a useful thing to know.
That's Mr Mullet to you, you mulletless wonder.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|