Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / September 2006

Tip: Looking for answers? Try searching our database.

Outlook application object

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Markus Donath - 26 Sep 2006 15:13 GMT
I want to create an Outlook-appointment using .NET VC.
My Visual Basic example starts with:

Dim oApp As Microsoft.Office.Interop.Outlook.Application = New
Microsoft.Office.Interop.Outlook.Application

But my C++ translation:

Microsoft::Office::Interop::Outlook::Application *oApp = new
Microsoft::Office::Interop::Outlook::Application;

does not compile. ('You cannot create an instance of an interface' or
something like that). Does anybody know, what's wrong here?

Markus
SvenC - 26 Sep 2006 21:12 GMT
Hi Markus,

>I want to create an Outlook-appointment using .NET VC.
> My Visual Basic example starts with:
[quoted text clipped - 9 lines]
> does not compile. ('You cannot create an instance of an interface' or
> something like that). Does anybody know, what's wrong here?

Why not copy the exact error message?

Do you use VC2003 or VC2005?

In VC2003 I would expect that something like ApplicationClass or
_ApplicationClass would be available which represents the so called COM
coclass. A coclass is an object you can instantiate and use by an interface
it implements, which would be Application in thiscase.

In VC2005 you would want to use the new C++/CLI which uses ^ instead of *
for managed pointers and gcnew instead of new.

--
SvenC

> Markus
Markus Donath - 27 Sep 2006 08:14 GMT
> Hi Markus,
>
[quoted text clipped - 13 lines]
>
> Why not copy the exact error message?

Because it is produced by German version of Visual Studio .NET 2003 and
thus, the error message is in German:

error C3153: 'Microsoft::Office::Interop::Outlook::Application': Sie
können keine Instanz einer Schnittstelle erstellen

> Do you use VC2003 or VC2005?

VC2003

> In VC2003 I would expect that something like ApplicationClass or
> _ApplicationClass would be available which represents the so called COM
> coclass. A coclass is an object you can instantiate and use by an interface
> it implements, which would be Application in thiscase.

Have you got an example?

> In VC2005 you would want to use the new C++/CLI which uses ^ instead of *
> for managed pointers and gcnew instead of new.
[quoted text clipped - 3 lines]
>
>> Markus
Carl Daniel [VC++ MVP] - 26 Sep 2006 22:31 GMT
>I want to create an Outlook-appointment using .NET VC.
> My Visual Basic example starts with:
[quoted text clipped - 9 lines]
> does not compile. ('You cannot create an instance of an interface' or
> something like that). Does anybody know, what's wrong here?

You have to use CoCreateInstance to create an instance of a COM class.  You
can't do it with new.

-cd
Markus Donath - 27 Sep 2006 08:16 GMT
>> I want to create an Outlook-appointment using .NET VC.
>> My Visual Basic example starts with:
[quoted text clipped - 14 lines]
>
> -cd

I would be happy, if you could give an example for 'CoCreateInstance' in
this context.

Markus
Willy Denoyette [MVP] - 27 Sep 2006 09:47 GMT
| >I want to create an Outlook-appointment using .NET VC.
| > My Visual Basic example starts with:
[quoted text clipped - 14 lines]
|
| -cd

Hmmm... this is a managed client, and the interop assembly is a managed
wrapper, so there is no problem to new an instance of the ApplicationClass.

Willy.
Willy Denoyette [MVP] - 27 Sep 2006 09:45 GMT
|I want to create an Outlook-appointment using .NET VC.
| My Visual Basic example starts with:
[quoted text clipped - 11 lines]
|
| Markus

Application refers to an interface which obviously cannot be instantiated,
you need to create an instance of ApplicationClass like :

Microsoft::Office::Interop::Outlook::ApplicationClass *oApp = new
Microsoft::Office::Interop::Outlook::ApplicationClass();

Willy.
Markus Donath - 27 Sep 2006 10:31 GMT
> |I want to create an Outlook-appointment using .NET VC.
> | My Visual Basic example starts with:
[quoted text clipped - 19 lines]
>
> Willy.

Okay, that's it. Thank you.
Markus

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.