From: Helmut Meukel on
"GS" <GS(a)discussions.microsoft.com> schrieb im Newsbeitrag
news:O%23h7r1i7KHA.6072(a)TK2MSFTNGP06.phx.gbl...
> After serious thinking David Kerber wrote :
>> Running VB6 on Win7 x64.
>>
>> Is there a way of getting my vb6 app to be able to use the outlook 11 object
>> lib while outlook 2003 is running?
>>
>> Set olk = New Outlook.Application
>>
>> works fine when outlook is not running on my machine, but when I have Outlook
>> 2003 running, I get "ActiveX component can't create object"
>>
>> Is there a way of letting this be shared?
>>
>> D
>
> Contrary to how most the other MSO apps work, Outlook does not allow multiple
> instances of itself. We can't create a 'New' instance of it when it's already
> running, and so we're forced to 'hijack' a running instance if there is one OR
> create our own instance if not. Hijacking a user's instance of any app is a
> risky affair that is generally not recommended, but in this case M$ gives us
> no choice. Thus, MikeD's advice is mandatory when trying to automate Outlook.
>
> To add to that advice, I suggest you use a 'flag' (i.e.: bNewOlkInstance) so
> your app knows if you hijacked a running instance or not. In this case, you
> want to leave it running if already in use. Otherwise, if you create your own
> instance you'll probably want to shut it down when you're done with it if you
> have no reason for turning it over to the user. In either case your object
> refs need to be destroyed when no longer needed (standard cleanup<g>).
>
> Regards,
> Garry
>


Garry,

what if the user is finished while my program still uses the hijacked
Outlook and the user tries to close Outlook?

Helmut.


From: GS on
Helmut Meukel explained :
> "GS" <GS(a)discussions.microsoft.com> schrieb im Newsbeitrag
> news:O%23h7r1i7KHA.6072(a)TK2MSFTNGP06.phx.gbl...
>> After serious thinking David Kerber wrote :
>>> Running VB6 on Win7 x64.
>>>
>>> Is there a way of getting my vb6 app to be able to use the outlook 11
>>> object lib while outlook 2003 is running?
>>>
>>> Set olk = New Outlook.Application
>>>
>>> works fine when outlook is not running on my machine, but when I have
>>> Outlook 2003 running, I get "ActiveX component can't create object"
>>>
>>> Is there a way of letting this be shared?
>>>
>>> D
>>
>> Contrary to how most the other MSO apps work, Outlook does not allow
>> multiple instances of itself. We can't create a 'New' instance of it when
>> it's already running, and so we're forced to 'hijack' a running instance if
>> there is one OR create our own instance if not. Hijacking a user's instance
>> of any app is a risky affair that is generally not recommended, but in this
>> case M$ gives us no choice. Thus, MikeD's advice is mandatory when trying
>> to automate Outlook.
>>
>> To add to that advice, I suggest you use a 'flag' (i.e.: bNewOlkInstance)
>> so your app knows if you hijacked a running instance or not. In this case,
>> you want to leave it running if already in use. Otherwise, if you create
>> your own instance you'll probably want to shut it down when you're done
>> with it if you have no reason for turning it over to the user. In either
>> case your object refs need to be destroyed when no longer needed (standard
>> cleanup<g>).
>>
>> Regards,
>> Garry
>>
>
>
> Garry,
>
> what if the user is finished while my program still uses the hijacked
> Outlook and the user tries to close Outlook?
>
> Helmut.

As I stated in my post, hijacking a user's instance is risky. In the
case of Outlook some kind of error handling must be used, which is not
always the best thing to have to work with. I prefer to never hijack a
running instance of any M$O app. It's not only safer to create/use my
own instance, it's easier to manage because I can lock it down so the
user can only access features required for the task at hand. This in no
way compromises the user's instance (if one was running), and nor can
the user use my instance for anything other than what my UI settings
allow.

The issue with automating Outlook while in use by the user raises a
situation that can be disasterous in the scenario you cite here. Thus,
your code will have to include a mechanism to handle user intervention.
I never automate any mail apps because it's easier to build the mail
message and start the user's default mail app as a separate process.
This way it doesn't matter to my app what the user does during the
Outlook session.

Otherwise, I can't imagine why anyone would want to manipulate a user's
mail app beyond preparing a message and displaying its UI to the user.
If I need my app to email info to myself there's other ways I can
handle it without invoking the user's mail app (or server).

In the case of providing automation of Outlook as a utility used
specifically with Outlook, I would rather create a M$O addin. This
could be VBA or a VB6 COMAddin.dll.

Garry


From: David Kerber on
In article <OOT$fRt7KHA.2292(a)TK2MSFTNGP04.phx.gbl>,
GS(a)discussions.microsoft.com says...

....


> Otherwise, I can't imagine why anyone would want to manipulate a user's
> mail app beyond preparing a message and displaying its UI to the user.
> If I need my app to email info to myself there's other ways I can
> handle it without invoking the user's mail app (or server).

I'm the OP, and I agree with this when it comes to mail, but what I need
to get to is the Exchange public folders from a VB6 app. The only way
I've found is through various outlook automation libs.

If there is another way of connecting to Exchange (and getting to public
folders) without using any piece of outlook that would be far better,
because it would allow us to use my app on machines that don't have
outlook on them.

D
From: GS on
David Kerber wrote on 5/10/2010 :
> In article <OOT$fRt7KHA.2292(a)TK2MSFTNGP04.phx.gbl>,
> GS(a)discussions.microsoft.com says...
>
> ...
>
>
>> Otherwise, I can't imagine why anyone would want to manipulate a user's
>> mail app beyond preparing a message and displaying its UI to the user.
>> If I need my app to email info to myself there's other ways I can
>> handle it without invoking the user's mail app (or server).
>
> I'm the OP, and I agree with this when it comes to mail, but what I need
> to get to is the Exchange public folders from a VB6 app. The only way
> I've found is through various outlook automation libs.
>
> If there is another way of connecting to Exchange (and getting to public
> folders) without using any piece of outlook that would be far better,
> because it would allow us to use my app on machines that don't have
> outlook on them.
>
> D

Hi David,
I understand your problem, and agree that another approach would be
better. Unfortunately, the only advice I can give you is to rephrase
your question so you get replies about working with Exchange. Since
it's likely that your users may not have Outlook installed, it's a more
direct approach to your app's needs to seek ideas for working with
Exchange directly OR possibly find other suggestions relating to
accomplishing your objectives.

Garry


From: Mike B on

"David Kerber" <ns_dkerber(a)ns_warrenrogersassociates.com> wrote in message
news:MPG.2651c93789bdf4bb989700(a)news.onecommunications.net...
> In article <OOT$fRt7KHA.2292(a)TK2MSFTNGP04.phx.gbl>,
> GS(a)discussions.microsoft.com says...
>
> ...
>
>
>> Otherwise, I can't imagine why anyone would want to manipulate a user's
>> mail app beyond preparing a message and displaying its UI to the user.
>> If I need my app to email info to myself there's other ways I can
>> handle it without invoking the user's mail app (or server).
>
> I'm the OP, and I agree with this when it comes to mail, but what I need
> to get to is the Exchange public folders from a VB6 app. The only way
> I've found is through various outlook automation libs.
>
> If there is another way of connecting to Exchange (and getting to public
> folders) without using any piece of outlook that would be far better,
> because it would allow us to use my app on machines that don't have
> outlook on them.

There is a fair amount of stuff out there using CDO to get to the Public
Folders...

If this wraps, unwrap it....

<:http://www.google.com/search?hl=en&as_q=Exchange+CDO+&as_epq=public+folders&as_oq=&as_eq=&num=10&lr=&as_filetype=&ft=i&as_sitesearch=&as_qdr=all&as_rights=&as_occt=any&cr=&as_nlo=&as_nhi=&safe=images>




> D