Application startup time

  • Thread starter Thread starter Mueller-Lynch Thomas
  • Start date Start date
M

Mueller-Lynch Thomas

Hello,

we have some startup issues with our Outlook application.
After loading our application there is a "timeout" of about 30 seconds
untill the application starts running. First we thought that this happens
every time on every client but then we found out that this is not true.
Within debug mode we found out that the timeout starts right when we clicked
on our main button (Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click) but the code below will
be executed some steps later ...

With sysinternal tools we found out that this might come from the
cryptnet.dll.
Any ideas?

Thomas

And here comes the VB.net code:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs

....
bla()
....

End Sub


....
Sub bla()
Dim myOlApp As Microsoft.Office.Interop.Outlook.Application
Dim myNamespace As Microsoft.Office.Interop.Outlook.NameSpace
myOlApp = New Microsoft.Office.Interop.Outlook.Application
myNamespace = myOlApp.GetNamespace("MAPI")
End Sub
....
 
Why are you declaring and instantiating an Application object there? You
won't be trusted for one thing. Use the Application object passed to you
when your addin starts up and derive all of your Outlook objects from that.

Generally that's done in the startup event handler and you use a globally
available Application (and usually NameSpace) object from then on.
 
Thank you Ken,

our application is not an Outllok add-in. It is a stand-alone Windows forms
application. Therefor we have to instantiate a Outllok application object,
haven't we?

Thanks Thomas
 
Yes, in a standalone application you have to instantiate an
Outlook.Application object that way. If it is taking that long to initialize
things then I wouldn't do it in the button click since that will be dead
time the user is sitting and waiting through. I'd instantiate my objects as
soon as the application starts up, when the user isn't likely to be waiting
on something.
 
Hi Ken,

yes we do this indeed at the very beginning - just to clarify this takes (at
some clients) up to 2 minutes - we found out that this depends also on the
number of outlook profiles ...

Any ideas?

Thanks

Thomas
 
Faster computers, fewer Outlook profiles, use something other than managed
code.

You can also move your startup and initialization code to a point after
Outlook starts up, perhaps by setting a timer when you start Outlook in
standalone code and letting Outlook finish starting up before doing any
time-consuming initializations in your code. For addin code you could put a
timer startup into the OnStartupComplete() event to initialize your stuff
after that event finishes.
 
Back
Top