Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
platform
active.directory
adsi
adsi.iis-admin
base
com_ole
complus_mts
component_svcs
database
directx
gdi
graphics_mm
internet.client
internet.server
internet.server.isapi-dev
localization
mapi
messaging
msi
mslayerforunicode
multimedia
networking
networking.ipv6
sdk_install
security
shell
telephony.tapi_2
telephony.tapi_3
telephony.tsp
telephony.wte
tools
ui
ui_shell
win_base_svcs
win16
  
 
date: Thu, 27 Sep 2007 20:09:45 -0400,    group: microsoft.public.platformsdk.messaging        back       


Exception caused by MapiInitiaze in interop env?   
Hello everyone,

I have a function CallerFunc( ) in a C# exe calling another function 
MyFunc( ) from C++ dll. MyFunc( ) deserializes an XML request and 
initializes Mapi using MapiInitialize. The first time call to MyFunc( ) is 
successful and I can do all MAPI stuff successfully. However, at the second 
call to MyFunc( ) from CallerFunc( ), I get an exception while deserializing 
XML in MyFunc( ). Weird thing is that if I don't call MyFunc( ) from a C# 
code but from a C++ test exe utility, there's never an exception. Also, if I 
comment out MAPI portion of the code from MyFunc( ), there's never an 
exception if called from C#. It appears that the exception is caused by 
MapiInitialize in an interop environment. Any ideas?

Caller function in C#

CallerFunc( )
{
    MyFunc( )
    ................
    //some code here
    ................
    MyFunc( )         ////Exception occurs if MyFunc is called second time
}


Called function in C++

void MyFunc( )
{
    //XML deserialization         ////Exception occurs here
    MapiInitialize(NULL);
    ..........
    //some code here
    .........
    MapiUnInitialize( );
    return;
}
date: Thu, 27 Sep 2007 20:09:45 -0400   author:   Varun Bansal

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us