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. Managed C++/CLI
  4. The wonderful world of MAPI [modified]

The wonderful world of MAPI [modified]

Scheduled Pinned Locked Moved Managed C++/CLI
c++questioncsharpcomperformance
2 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.
  • O Offline
    O Offline
    originSH
    wrote on last edited by
    #1

    Ok so I'll start by declaring my undying love for C# :P it's my primary language and I try to stick to the managed world where ever possible. This time though I need to use some stuff where pInvoke just wont cut it so I'm using my lacking and very dodgy C++/Cli skills :P so please forgive me if I say anything stupid ;) I'm currently working with this MAPI function: OpenIMsgOnIStg[^] Due to the wonderful fact that it requires Memory Management Functions to be passed to it: lpAllocateBuffer [in] Pointer to the MAPIAllocateBuffer function, to be used where required by MAPI to allocate memory. lpAllocateMore [in] Pointer to the MAPIAllocateMore function, to be used where required by MAPI to allocate additional memory. lpFreeBuffer [in] Pointer to the MAPIFreeBuffer function, to be used where required by MAPI to free memory. I'm not even going to go near it with pInvoke. I've translated this article: INFO: Save Message to MSG Compound File[^] into a standalone native method and I'm now trying to put together the C++/Cli code to act as the go between. The biggest problem I'm currently facing is trying to convert a System::Object into a LPMESSAGE. None of the casts seem to want to work and I'm not sure of the next direction to try :S does anyone have any suggestions on how to cast/convert? -- modified at 6:23 Wednesday 11th July, 2007 EDIT: Realised I hadn't acctually asked a question :doh:

    O 1 Reply Last reply
    0
    • O originSH

      Ok so I'll start by declaring my undying love for C# :P it's my primary language and I try to stick to the managed world where ever possible. This time though I need to use some stuff where pInvoke just wont cut it so I'm using my lacking and very dodgy C++/Cli skills :P so please forgive me if I say anything stupid ;) I'm currently working with this MAPI function: OpenIMsgOnIStg[^] Due to the wonderful fact that it requires Memory Management Functions to be passed to it: lpAllocateBuffer [in] Pointer to the MAPIAllocateBuffer function, to be used where required by MAPI to allocate memory. lpAllocateMore [in] Pointer to the MAPIAllocateMore function, to be used where required by MAPI to allocate additional memory. lpFreeBuffer [in] Pointer to the MAPIFreeBuffer function, to be used where required by MAPI to free memory. I'm not even going to go near it with pInvoke. I've translated this article: INFO: Save Message to MSG Compound File[^] into a standalone native method and I'm now trying to put together the C++/Cli code to act as the go between. The biggest problem I'm currently facing is trying to convert a System::Object into a LPMESSAGE. None of the casts seem to want to work and I'm not sure of the next direction to try :S does anyone have any suggestions on how to cast/convert? -- modified at 6:23 Wednesday 11th July, 2007 EDIT: Realised I hadn't acctually asked a question :doh:

      O Offline
      O Offline
      originSH
      wrote on last edited by
      #2

      Well I'm not sure if this is the cleanest way of doing it but it works :D System::IntPtr ipMsg = System::Runtime::InteropServices::Marshal::GetIUnknownForObject(iMessage); LPMESSAGE iMessageToSave = (LPMESSAGE)(ipMsg.ToPointer()); Obviously it was the right underlying native type otherwise the way I use it later would have bombed. I'm quite chuffed with how relativly easy and painless this was :)

      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