473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Outlook application object

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
Sep 26 '06 #1
7 2777
Hi Markus,

"Markus Donath" <ne******@microsoft.comwrote in message
news:OO**************@TK2MSFTNGP04.phx.gbl...
>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?
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

Sep 26 '06 #2
"Markus Donath" <ne******@microsoft.comwrote in message
news:OO**************@TK2MSFTNGP04.phx.gbl...
>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?
You have to use CoCreateInstance to create an instance of a COM class. You
can't do it with new.

-cd
Sep 26 '06 #3
SvenC wrote:
Hi Markus,

"Markus Donath" <ne******@microsoft.comwrote in message
news:OO**************@TK2MSFTNGP04.phx.gbl...
>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::Applicatio n *oApp = new
Microsoft::Office::Interop::Outlook::Applicatio n;
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?
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.

--
SvenC
>Markus

Sep 27 '06 #4
Carl Daniel [VC++ MVP] wrote:
"Markus Donath" <ne******@microsoft.comwrote in message
news:OO**************@TK2MSFTNGP04.phx.gbl...
>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::Applicatio n *oApp = new
Microsoft::Office::Interop::Outlook::Applicatio n;
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

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

Markus
Sep 27 '06 #5

"Markus Donath" <ne******@microsoft.comwrote in message
news:OO**************@TK2MSFTNGP04.phx.gbl...
|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

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

Microsoft::Office::Interop::Outlook::ApplicationCl ass *oApp = new
Microsoft::Office::Interop::Outlook::ApplicationCl ass();
Willy.
Sep 27 '06 #6

"Carl Daniel [VC++ MVP]" <cp*****************************@mvps.org.nospam >
wrote in message news:%2***************@TK2MSFTNGP02.phx.gbl...
| "Markus Donath" <ne******@microsoft.comwrote in message
| news:OO**************@TK2MSFTNGP04.phx.gbl...
| >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?
|
| You have to use CoCreateInstance to create an instance of a COM class.
You
| can't do it with new.
|
| -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.

|
Sep 27 '06 #7
Willy Denoyette [MVP] wrote:
"Markus Donath" <ne******@microsoft.comwrote in message
news:OO**************@TK2MSFTNGP04.phx.gbl...
|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

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

Microsoft::Office::Interop::Outlook::ApplicationCl ass *oApp = new
Microsoft::Office::Interop::Outlook::ApplicationCl ass();
Willy.

Okay, that's it. Thank you.
Markus
Sep 27 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: LEBRUN Thomas | last post by:
Hello :) I would like to use Outlook 2003 in my application so for that, i've added the referece to Outlook 11.0 Object Model to my project. Then, I try this simple code : using System;...
10
by: John | last post by:
Hi When I open a new outlook email from vb.net, sometimes outlook is very slow to appear or occasionally outlook freezes completely. I am targeting mixed office2000/xp environments so I am...
2
by: John | last post by:
Hi I am trying to find the way to create an email in outlook. I am using the code given at the end. It works fine the first time but calling the code second time gives the following error; ...
7
by: Chris Thunell | last post by:
I'm trying to loop through an exchange public folder contact list, get some information out of each item, and then put it into a vb.net datatable. I run though the code and all works fine until i...
4
by: digger27 | last post by:
I am trying to progamatically create tasks in Outlook using VB.Net. I am using the following code: **** Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles...
3
by: wizzbangca | last post by:
Hi everyone. Having problems with a utility I am writing for work. The previous IT Director thoughtfully allowed 3 (2000, xp, 2003) versions of outlook to be installed rather than 1. Now I need...
4
by: Pieter | last post by:
Hi, On the pc of one of my clients (W2000, Office 2003) I'm getting sometimes an exception when moving (Move) a MailItem to an Outlook-Folder: The RPC server is not available. (Exception from...
2
by: Pieter | last post by:
Hi, I'm using a thight integration with Outlook 2003 (with an Exchange server) in my VB.NET (2005) application. Until now I'm using the Outlook Object Model, but it appears to be very slow, and...
7
by: Dean Spencer | last post by:
Can anyone help? I am importing Emails from Outlook using the following code: Public Function ScanInbox(SubjectLine As String) Dim TempRst As Recordset Dim OlApp As Outlook.Application Dim...
23
by: andyoye | last post by:
How can I launch Outlook on users machines when they click a button on a web form (InfoPath)? Thanks
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.