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 Part II.

The wonderful world of MAPI Part II.

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

    So after much jubulation and sacrifices to the gods of managed/native code I continued on with my Outlook Addin. The native code I have is working fine untill I introduce a thread to take the workload away from the GUI thread. Now the exact same code is throwing: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. Once I have created the thread I grab a list of the items I'm interested in from Outlook (which is the main thread). I then take each of these managed object and retrive the native object (still reprisented as a System.Object) and pass them over to my C++/Cli. In the managed C++/Cli I use System::Runtime::InteropServices::Marshal::GetIUnknownForObject(iMessage); to retrive and IntPtr and then LPMESSAGE iMessageToSave = (LPMESSAGE)(ipMsg.ToPointer()); to convert it into a native object. The native object is passed to the native C++ method which dies as soon as I try to pIMessageToSave->CopyTo(), where pIMessageToSave is the same native object. As I said ... it works fine without threading but dies with it :S Any suggestions?

    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