Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. COM Interop (still confused)

COM Interop (still confused)

Scheduled Pinned Locked Moved C#
comcsharpwinformsxmllearning
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Adrian Hall
    wrote on last edited by
    #1

    Im still confused and going round in circles with this stuff. Bear with me as I explain what I have done and am doing. What I am attempting to do is write a "quick and dirty" MAPI Service Provider to implement a mail sender that posts via an XML interface over HTTP. The XML interface over HTTP bit is working already. Now, my thought was "Well, .NET does XML nicely so I don't have to get dirty with that stuff", and so I decided to learn what was involved in writing a service provider. Step 1: Read all about it - In this case, this meant digging up a copy of "Inside MAPI", which is apparently the only book on writing service providers. I tried going through the MSDN collection, but - quite frankly - in this area, it sucks (altho I did come across an article saying "MAPI isn't dead yet", which is heartening). Now, in reading, I learnt that I needed to do the following: - Code a Windows DLL with implements ServiceEntry() and XPProviderInit() and three COM interfaces (IXPProvider, IXPLogon and IMAPIStatus, all of which seem to inherit IUnknown). I figured here that ServiceEntry() and XPProviderInit() will have to be in some class - probably the "default" class, if such a beast exists - since these will kick off Windows Forms for configuration dialogs, this shouldn't really be the stumbling block. So I decided my first task was coding the .NET replacements for IXPLogon, IXPProvider, and IMAPIStatus. This is where I get confused, and Microsofts reference turns me round and round in a circular mess until I am confused. Thus far, I get to the following code, which I think is right using System; using System.Runtime.InteropServices; namespace MAPI.Extended { [Guid("insert-my-generated-guid-here")] interface IXPLogon { // HRESULT TransportLogon(ULONG FAR *lpulFlags); void Shutdown(UInt32 lpulFlags); // HRESULT TransportLogon( // LPMAPISUP lpMAPISup, // ULONG ulUIParam, // LPTSTR lpszProfileName, // ULONG FAR * lpulFlags, // LPMAPIERROR FAR *lppMAPIError, // LPXPLOGON FAR * lppXPLogon); } } Now, this last one has me more than a little concerned, but I figure that if I can work this one out, then I am in good shape for the other ones. The MSDN documentation says ULONG becomes a UInt32, LPTSTR becomes a String - this is fairly easy. LPMAPISUP is a pointer to an object which implements IMAPISupport. Thus, I figure I can replace that with IMAPISupport lpMAPISup possi

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups