I have created the .idl file and the definition looks something like
---------------------------------------------------------
[
uuid(797EE151-A04D-11d2-8072-00C04FC986D1),
helpstring("Provides extra information about the last error.")
]
interface IOlkErrorUnknown: IUnknown
{
[id(1), helpstring("method GetLastError")] HRESULT GetLastError( [in]
HRESULT hr, [out] LPWSTR *ppwszError);
};
---------------------------------------------------------
But when compiling I get this error
D:\My Documents\Programming\Visual C++\MAPI1\AccountManager.idl(8) :
error MIDL2025 : syntax error : expecting a type specification near
"HRESULT"
D:\My Documents\Programming\Visual C++\MAPI1\AccountManager.idl(8) :
error MIDL2026 : cannot recover from earlier syntax errors; aborting
compilation
---------------------------------------------------------
Please tell me how to resolve the issue.
Regards,
Ashutosh
In the beginning of your IDL file put these directives:
import "oaidl.idl";
import "ocidl.idl";
It will bring common COM types and definitions.
HTH
Alex
//DEFINE_GUID(IID_IOlkErrorUnknown, 0x9240a6c0, 0xaf41, 0x11d2, 0x8c,
0x3b, 0x0, 0x10, 0x4b, 0x2a, 0x66, 0x76);
[
uuid(9240a6c0-af41-11d2-8C3B-00104B2A6676)
]
interface IOlkErrorUnknown: IUnknown
{
HRESULT GetLastError( [in] HRESULT hr, [out] LPWSTR *ppwszError);
};
---------------------------------------------------------
But, I get these errors
D:\My Documents\Programming\Visual C++\MAPI1\AccountManager.idl(9) :
error MIDL2311 : statements outside library block are illegal in
mktyplib compatability mode : [ Interface 'IOlkErrorUnknown' ]
D:\My Documents\Programming\Visual C++\MAPI1\AccountManager.idl(9) :
error MIDL2096 : duplicated attribute : [uuid] [ Interface
'IOlkErrorUnknown' ]
---------------------------------------------------------
The special thing about this interface is that its provided by the MAPI
system, but there doesn't exist any header file for this. I just want to
create an object of this interface/class and not create a COM server myself.
Regards,
Ashutosh Bhatt
So you don't need any IDL files at all. Just find out which
EXE/DLL/OCX implements the object and #import it in your CPP file.
Then the compiler will generate all necessary headers.
Alex
The thing is, I don't know which file actually implements these interfaces.
Please have a look at this
1) http://msdn2.microsoft.com/en-us/library/aa203900(office.11).aspx
(provided/implemented by outlook - IID is defined by Microsoft)
2) http://msdn2.microsoft.com/en-us/library/aa203932(office.11).aspx
(provided by CLIENT - IID is again fixed)
it contains interface references. I know the IID of the interface but
don't know the file. So, how do I implement/use them?
Regards,
A B
I don't have the MS Office at hand right now. I'll look into it
tomorrow. I think there must be some kind of SDK for Office, too.
Alex
Alex
The interface is not automation-compatible, and thus unlikely to be
described in any type library.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
See if this helps:
http://support.microsoft.com/kb/243219
You may refer to:
Introducing the Outlook Integration API
http://blogs.msdn.com/stephen_griffin/archive/2004/12/16/introducing-the-out
look-integration-api.aspx
Need help with IOlkAccount
http://groups.google.com/group/microsoft.public.office.developer.outlook.vba
/browse_thread/thread/933ab390f56aa206/3c28e2f44ac12dc1?hl=en&lnk=st&q=IOlkA
ccount+mapi#3c28e2f44ac12dc1
Regarding the error "statements outside library block are illegal in
mktyplib compatibility mode" in your second response, per my experiences,
you should be able to resolve it according to either of the following two
methods:
1. Put all the definitions of interfaces, coclasses and enums etc inside a
library block like this:
[
uuid(<library guid>),
version(<library version>),
helpstring(<library description>)
]
library MyLib
{
// interfaces, coclasses, enums etc
}
2. Configure the MIDL not to be mktyblib-compatible. In Visual Studio,
right-click the IDL file, click Properties, expand MIDL->General and set
"MkTypLib compatible" to No.
Hope this helps. If you have any other questions or concerns, please feel
free to let me know.
Best regards,
Charles Wang
Microsoft Online Community Support
===========================================================
Delighting our customers is our #1 priority. We welcome your
comments and suggestions about how we can improve the
support we provide to you. Please feel free to let my manager
know what you think of the level of service provided. You can
send feedback directly to my manager at: msd...@microsoft.com.
===========================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for
non-urgent issues where an initial response from the community
or a Microsoft Support Engineer within 1 business day is acceptable.
Please note that each follow up response may take approximately
2 business days as the support professional working with you may
need further investigation to reach the most efficient resolution.
The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by
contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
============================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
=========================================================
I have created the attached .h file, AccountManager.h (its not complete
thought but the interface IOlkAccountManager is complete) and trying
to create and object of IOlkAccountManager, by these lines
IOlkAccountManager * ppv;
CoCreateInstance(CLSID_OlkAccountManager,NULL, 0,
IID_IOlkAccountManager, (void**)&ppv);
For this I get Linker error,
MAPI1Dlg.obj : error LNK2001: unresolved external symbol
_CLSID_OlkAccountManager
MAPI1Dlg.obj : error LNK2001: unresolved external symbol
_IID_IOlkAccountManager
What should I do?? If I have to create a library for these, what will be
the Library's GUID? I didn't find any thing mentioned in the MSDN for
the library. Only Interfaces are mentioned.
Regards,
Ashutosh
I have created a header file and also followed the steps in the above
mentioned KB, but still no hope.
Please have a look at my reply to Charles Wang for the same issue.
Regards,
Ashutosh
Regards,
Ashutosh
//{ed475411-b0d6-11d2-8c3b-00104b2a6676}
DEFINE_GUID(CLSID_OlkPOP3Account, 0xed475411, 0xb0d6, 0x11d2, 0x8c, 0x3b,
0x0, 0x10, 0x4b, 0x2a, 0x66, 0x76);
//{ed475412-b0d6-11d2-8c3b-00104b2a6676}
DEFINE_GUID(CLSID_OlkIMAP4Account, 0xed475412, 0xb0d6, 0x11d2, 0x8c, 0x3b,
0x0, 0x10, 0x4b, 0x2a, 0x66, 0x76);
//{ed475414-b0d6-11d2-8c3b-00104b2a6676}
DEFINE_GUID(CLSID_OlkMAPIAccount, 0xed475414, 0xb0d6, 0x11d2, 0x8c, 0x3b,
0x0, 0x10, 0x4b, 0x2a, 0x66, 0x76);
//{ed475418-b0d6-11d2-8c3b-00104b2a6676}
DEFINE_GUID(CLSID_OlkMail, 0xed475418, 0xb0d6, 0x11d2, 0x8c, 0x3b, 0x0,
0x10, 0x4b, 0x2a, 0x66, 0x76);
//{ed475419-b0d6-11d2-8c3b-00104b2a6676}
DEFINE_GUID(CLSID_OlkAddressBook, 0xed475419, 0xb0d6, 0x11d2, 0x8c, 0x3b,
0x0, 0x10, 0x4b, 0x2a, 0x66, 0x76);
//{ed475420-b0d6-11d2-8c3b-00104b2a6676}
DEFINE_GUID(CLSID_OlkStore, 0xed475420, 0xb0d6, 0x11d2, 0x8c, 0x3b, 0x0,
0x10, 0x4b, 0x2a, 0x66, 0x76);
//{4db5cbf0-3b77-4852-bc8e-bb81908861f3}
DEFINE_GUID(CLSID_OlkHotmailAccount, 0x4db5cbf0, 0x3b77, 0x4852, 0xbc,
0x8e, 0xbb, 0x81, 0x90, 0x88, 0x61, 0xf3);
//{4db5cbf2-3b77-4852-bc8e-bb81908861f3}
DEFINE_GUID(CLSID_OlkLDAPAccount, 0x4db5cbf2, 0x3b77, 0x4852, 0xbc, 0x8e,
0xbb, 0x81, 0x90, 0x88, 0x61, 0xf3);
//{9240A6C0-AF41-11d2-8C3B-00104B2A6676}
DEFINE_GUID(IID_IOlkErrorUnknown, 0x9240a6c0, 0xaf41, 0x11d2, 0x8c, 0x3b,
0x0, 0x10, 0x4b, 0x2a, 0x66, 0x76);
//{9240A6C1-AF41-11d2-8C3B-00104B2A6676 }
DEFINE_GUID(IID_IOlkEnum, 0x9240a6c0, 0xaf41, 0x11d2, 0x8c, 0x3b, 0x0,
0x10, 0x4b, 0x2a, 0x66, 0x76);
//{9240a6c3-af41-11d2-8c3b-00104b2a6676}
DEFINE_GUID(IID_IOlkAccountNotify, 0x9240a6c3, 0xaf41, 0x11d2, 0x8c, 0x3b,
0x0, 0x10, 0x4b, 0x2a, 0x66, 0x76);
//{9240a6cb-af41-11d2-8c3b-00104b2a6676}
DEFINE_GUID(IID_IOlkAccountHelper, 0x9240a6cb, 0xaf41, 0x11d2, 0x8c, 0x3b,
0x0, 0x10, 0x4b, 0x2a, 0x66, 0x76);
//{9240a6cd-af41-11d2-8c3b-00104b2a6676}
DEFINE_GUID(IID_IOlkAccountManager, 0x9240a6cd, 0xaf41, 0x11d2, 0x8c, 0x3b,
0x0, 0x10, 0x4b, 0x2a, 0x66, 0x76);
//{9240a6d2-af41-11d2-8c3b-00104b2a6676}
DEFINE_GUID(IID_IOlkAccount, 0x9240a6d2, 0xaf41, 0x11d2, 0x8c, 0x3b, 0x0,
0x10, 0x4b, 0x2a, 0x66, 0x76);
----------------------------------------------------------------------------
----------------------------------------------------------------------------
---
and then declare all those functions in a separate header file (iolk.h)
according to Outlook 2003 Integration API Reference. After you finish these
jobs, rebuild and run your project again.
Hope this helps. If you have any other questions or concerns, please feel
free to let me know.
Best regards,
Charles Wang
Microsoft Online Community Support
=========================================================
Delighting our customers is our #1 priority. We welcome your
comments and suggestions about how we can improve the
support we provide to you. Please feel free to let my manager
know what you think of the level of service provided. You can
send feedback directly to my manager at: msd...@microsoft.com.
=========================================================
mapi32.lib Edkguid.lib Edkutils.lib Edkmapi.lib Addrlkup.lib
Edkdebug.lib Version.lib Mblogon.lib
Regards,
Ashutosh
Ashutosh wrote:
> Hi Charles,
> I have changed the code as you said. But I get Linker error when
> including these lines of code
>
> IOlkAccountManager * ppv;
> CoCreateInstance(CLSID_OlkAccountManager,NULL, 0,
> IID_IOlkAccountManager, (void**)&ppv);
>
> The errors I get are
>
> Linking...
> MAPI1Dlg.obj : error LNK2001: unresolved external symbol
> _CLSID_OlkAccountManager
> MAPI1Dlg.obj : error LNK2001: unresolved external symbol
> _IID_IOlkAccountManager
> Debug/MAPI1.exe : fatal error LNK1120: 2 unresolved externals
>
> The headers files I created are also attached.
>
> Please advice.
>
> Regards,
> Ashutosh
>
Right now, could you please first read this KB article to see if it helps?
How to avoid error "LNK2001 unresolved external" by using DEFINE_GUID
http://support.microsoft.com/kb/130869
If you have any other questions or concerns, please feel free to let me
know. I am very glad to work with you for further research.
When I replaced "#include <guiddef.h>" by "#include "INITGUID.H" in your
header file AccountManagerGUIDs.h, it worked perfectly.
I also added "#pragma once" to the header of your header file.
Hope this helps. Please feel free to let me know if you have any other
questions or concerns. Have a nice day!
IOlkAccountManager * ppv = NULL;
HRESULT hr= CoCreateInstance(CLSID_OlkAccountManager,NULL, 0,
IID_IOlkAccountManager, (void**)&ppv);
Object creation has nothing to do with the interface definition. It's
required only if the object is used and as far as GUIDs are concerned, I
don't think there is any problem with them. So, whys isn't the object
getting created? Can you please check?
Regards,
Ashutosh
Regards,
Ashutosh
> The error code is Class not registered (80040154)
Please check with regedit if you have this key on your
machine:
HKEY_CLASSES_ROOT\CLSID\
{ED475410-B0D6-11D2-8C3B-00104B2A6676}\InprocServer32
If yes, what values do you find underneath?
--
SvenC
(default) = C:\PROGRA~1\MICROS~4\Office12\OLMAPI32.DLL
ThreadingModel = Both
I checked the dll, it exists but its not a com server. It's probably a
wrapper.
Regards,
Ashutosh
> The key exists and the values are
>
> (default) = C:\PROGRA~1\MICROS~4\Office12\OLMAPI32.DLL
> ThreadingModel = Both
>
> I checked the dll, it exists but its not a com server. It's probably a
> wrapper.
How did you check that it is not a com server?
It does export DllGetClassObject.
--
SvenC
By the way, how did you check that it exports DllGetClassObject???
Regards,
Ashutosh
May I gently suggest an introductory COM text here:
"Inside COM" by Dale Rogerson, MS Press
Finally, you are barking up the wrong tree since COM is out of topic
in the C/C++ group. The correct group for COM questions is:
microsoft.public.win32.programmer.ole
--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnic...@mvps.org
MVP VC FAQ: http://vcfaq.mvps.org
=====================================
"Ashutosh" <smbs...@newsgroup.nospam> wrote in message
news:endBpUln...@TK2MSFTNGP04.phx.gbl...
Regards,
Ashutosh
Regards,
Ashutosh
> I just tried to open the dll in the object browser of the Visual
> studio 2005.
I doubt the object browser will open a dll
> By the way, how did you check that it exports DllGetClassObject???
Dependency Walker gives you a list of imports and exports.
--
SvenC