Good question.
I'm working on an application which manages information about units in the field
which could have problems. This requires that we have some kind of "generate a service call" option.
Basically when the user clicks the "Generate service call" button, the email client of choice, whether
it be MS Office 2000/2002/XP/2003 or Outlook Expressed is launched and information about the
deffective unit is dumped into the body of the email. The user then selects the recipient - ie some service
person who needs to go out in the field and fix the unit, and sends the email OR could technically just close
the Outlook window created.
I'm actually using late binding in my code, not the example I posted earlier. As it turns out when an instance
of Outlook is launched, even if the user clicks on the "Send" button in Outlook to send the message and
the window closes, if you check in the task manager OUTLOOK.EXE still hangs in memory. This also
happens even if the user just closes the Outlook window without sending any message.
I could just grab the address book from either program and create my own email window with the contacts
on one side and I won't have to worry about launching any Outlook or Outlook Express instance, but.... I
kind of wanted to just launch the email application of choice.
I suppose it's not possible to do all this in .NET?
"Willy Denoyette [MVP]" <wi*************@telenet.be> wrote in message news:eG**************@TK2MSFTNGP12.phx.gbl...
"Max" <ma******@yahoo.com> wrote in message
news:eD*************@TK2MSFTNGP10.phx.gbl... Thanks for your reply Willy!
What if the user decides not to send this email and just presses the close
button in Outlook. Is there a way to know when the user does this so I can
kill the Outlook process programatically
to remove it from memory?
Cheers,
Max
Well, there is something wrong with your scenario. You are using COM interop
to automate Outlook, but at the same time you are using Outlook in an
interactive fashion, these two don't go well together, whenever you switch
to interactive mode as by calling Display(), you put the responsabilty to
interact and exit the application in the hands of the interactive user, else
you don't show the UI and it's up to the .NET (well, COM) client to clean up
after it has done. In you scenario there is no way for the client
application to know whether the interactiv user doesn't want to send a mail
message.
Really, I wonder why you are doing this.
Willy.