PC Review


Reply
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average.

Search of an event fired immediate before Quit-event

 
 
Peter Ostermann
Guest
Posts: n/a
 
      5th Apr 2007
Hi NG,

as everybody knows minimizing Outlook 2007 creates a little Icon in the
system-tray, and it is recommendable to minimize it, every time after usage,
because it takes a while to start Outlook again after closed.

The user nevertheless often falls victim his habit, to close applications
after usage. I try to show a prompt before closing to stop "Quit", but once
the Quit event is released it seems that it can't be stopped anymore, even
though the prompt still happens.
Here the code:

Private Sub Application_Quit()
OK = MsgBox("Really want to quit?", vbYesNo, "Closing Outlook")
If OK <> 6 _
Then
OK = MsgBox("Quit stopped, minimized", vbYes, "Closing Outlook")
Call MinimizeActiveWindow
End If
OK = MsgBox("Test completed", vbYes, "Closing Outlook")
MsgBox "Goodbye, " & Application.GetNamespace("MAPI").CurrentUser
End Sub

Sub MinimizeActiveWindow()
OK = MsgBox("There is no window anymore that could be minimized", vbYes,
"Closing Outlook")
ActiveWindow.WindowState = olMinimized
End Sub


How would a "Quit-stop" look like to solve this problem?

Regards
Peter Ostermann


 
Reply With Quote
 
 
 
 
Ken Slovak - [MVP - Outlook]
Guest
Posts: n/a
 
      5th Apr 2007
You can't stop it. By the time Application.Quit fires all the Outlook
objects are already out of scope and have been released. There is no
BeforeQuit event and the BeginShutdown event in COM addins has no Cancel
argument to stop a shutdown.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Peter Ostermann" <(E-Mail Removed)> wrote in message
news:ev2jah$tiu$00$(E-Mail Removed)-online.com...
> Hi NG,
>
> as everybody knows minimizing Outlook 2007 creates a little Icon in the
> system-tray, and it is recommendable to minimize it, every time after
> usage, because it takes a while to start Outlook again after closed.
>
> The user nevertheless often falls victim his habit, to close applications
> after usage. I try to show a prompt before closing to stop "Quit", but
> once the Quit event is released it seems that it can't be stopped anymore,
> even though the prompt still happens.
> Here the code:
>
> Private Sub Application_Quit()
> OK = MsgBox("Really want to quit?", vbYesNo, "Closing Outlook")
> If OK <> 6 _
> Then
> OK = MsgBox("Quit stopped, minimized", vbYes, "Closing Outlook")
> Call MinimizeActiveWindow
> End If
> OK = MsgBox("Test completed", vbYes, "Closing Outlook")
> MsgBox "Goodbye, " & Application.GetNamespace("MAPI").CurrentUser
> End Sub
>
> Sub MinimizeActiveWindow()
> OK = MsgBox("There is no window anymore that could be minimized",
> vbYes, "Closing Outlook")
> ActiveWindow.WindowState = olMinimized
> End Sub
>
>
> How would a "Quit-stop" look like to solve this problem?
>
> Regards
> Peter Ostermann
>


 
Reply With Quote
 
 
 
 
Peter Ostermann
Guest
Posts: n/a
 
      5th Apr 2007
Thanks, Ken,

I understand.
May be there is a more simple workaround possible:
How can I disable the cross at right hand side of the Outlook
window bar?

Peter

"Ken Slovak - [MVP - Outlook]" <(E-Mail Removed)> schrieb im Newsbeitrag
news:O%(E-Mail Removed)...
> You can't stop it. By the time Application.Quit fires all the Outlook
> objects are already out of scope and have been released. There is no
> BeforeQuit event and the BeginShutdown event in COM addins has no Cancel
> argument to stop a shutdown.
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
> Reminder Manager, Extended Reminders, Attachment Options
> http://www.slovaktech.com/products.htm
>
>
> "Peter Ostermann" <(E-Mail Removed)> wrote in message
> news:ev2jah$tiu$00$(E-Mail Removed)-online.com...
>> Hi NG,
>>
>> as everybody knows minimizing Outlook 2007 creates a little Icon in the
>> system-tray, and it is recommendable to minimize it, every time after
>> usage, because it takes a while to start Outlook again after closed.
>>
>> The user nevertheless often falls victim his habit, to close applications
>> after usage. I try to show a prompt before closing to stop "Quit", but
>> once the Quit event is released it seems that it can't be stopped
>> anymore, even though the prompt still happens.
>> Here the code:
>>
>> Private Sub Application_Quit()
>> OK = MsgBox("Really want to quit?", vbYesNo, "Closing Outlook")
>> If OK <> 6 _
>> Then
>> OK = MsgBox("Quit stopped, minimized", vbYes, "Closing Outlook")
>> Call MinimizeActiveWindow
>> End If
>> OK = MsgBox("Test completed", vbYes, "Closing Outlook")
>> MsgBox "Goodbye, " & Application.GetNamespace("MAPI").CurrentUser
>> End Sub
>>
>> Sub MinimizeActiveWindow()
>> OK = MsgBox("There is no window anymore that could be minimized",
>> vbYes, "Closing Outlook")
>> ActiveWindow.WindowState = olMinimized
>> End Sub
>>
>>
>> How would a "Quit-stop" look like to solve this problem?
>>
>> Regards
>> Peter Ostermann
>>

>



 
Reply With Quote
 
Ken Slovak - [MVP - Outlook]
Guest
Posts: n/a
 
      5th Apr 2007
You can't do that either.

I suppose you could by getting the window that displays that control using
Win32 API calls and then find the control and send it a Windows message to
disable itself. You might have to change the window type displayed by
Outlook to not show the Close button, usually you lose the minimize and
resize controls too when you do that, and I'm not sure that Outlook would
like you messing around with it's dialog window type.

But I guess you could try it.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Peter Ostermann" <(E-Mail Removed)> wrote in message
news:ev348n$jmd$02$(E-Mail Removed)-online.com...
> Thanks, Ken,
>
> I understand.
> May be there is a more simple workaround possible:
> How can I disable the cross at right hand side of the Outlook
> window bar?
>
> Peter


 
Reply With Quote
 
Michael Bauer [MVP - Outlook]
Guest
Posts: n/a
 
      6th Apr 2007


Peter, please send me an e-mail. I've an application developed that enables
you to cancel the quit process.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Quick-Cats - The most effective way to assign Outlook categories:
http://www.shareit.com/product.html?...4&languageid=1
(German: http://www.VBOffice.net/product.html?pub=6)

Am Thu, 5 Apr 2007 12:31:52 +0200 schrieb Peter Ostermann:

> Hi NG,
>
> as everybody knows minimizing Outlook 2007 creates a little Icon in the
> system-tray, and it is recommendable to minimize it, every time after

usage,
> because it takes a while to start Outlook again after closed.
>
> The user nevertheless often falls victim his habit, to close applications
> after usage. I try to show a prompt before closing to stop "Quit", but

once
> the Quit event is released it seems that it can't be stopped anymore, even
> though the prompt still happens.
> Here the code:
>
> Private Sub Application_Quit()
> OK = MsgBox("Really want to quit?", vbYesNo, "Closing Outlook")
> If OK <> 6 _
> Then
> OK = MsgBox("Quit stopped, minimized", vbYes, "Closing Outlook")
> Call MinimizeActiveWindow
> End If
> OK = MsgBox("Test completed", vbYes, "Closing Outlook")
> MsgBox "Goodbye, " & Application.GetNamespace("MAPI").CurrentUser
> End Sub
>
> Sub MinimizeActiveWindow()
> OK = MsgBox("There is no window anymore that could be minimized",

vbYes,
> "Closing Outlook")
> ActiveWindow.WindowState = olMinimized
> End Sub
>
>
> How would a "Quit-stop" look like to solve this problem?
>
> Regards
> Peter Ostermann

 
Reply With Quote
 
New Member
Join Date: Jun 2012
Posts: 1
 
      5th Jun 2012
Hello Michael,

I do not see an email posted for you here and I am attempting to use this same code to move objects from one folder to another when a user chooses to exit/quit Outlook. Would your application work in this instance?
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
custom server control event before Page_Load fired Michal Valent Microsoft ASP .NET 2 27th Nov 2007 05:25 PM
How to know which event fired before it is handled? SevDer Microsoft C# .NET 1 27th Aug 2005 02:55 AM
Calling Web Service in DragDrop event causes event to be fired multipletimes Vincent Mouton Microsoft Dot NET Framework Forms 0 18th Mar 2005 08:28 PM
Before Update Event Not Fired?? Michael Watts Microsoft Access Forms 1 3rd Jun 2004 07:20 AM
Button.Init? how Do I know if click event has been fired? TextBox.TextChanged event before Button.Click in a CompositeCustomControl. jorge Microsoft ASP .NET 2 26th May 2004 12:45 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:07 AM.