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. Callback in C++ to invoke object in MC++

Callback in C++ to invoke object in MC++

Scheduled Pinned Locked Moved Managed C++/CLI
csharpc++helptutorialquestion
2 Posts 2 Posters 3 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.
  • E Offline
    E Offline
    Elf
    wrote on last edited by
    #1

    Hi! I have a C++ class with a callback function. Now I wanna use this class in .NET enviroment. So according the guide, i wrap it in a managed class. But the problem is the callback. The unmanaged class must have an ability to callback the managed class. How can the callback function in unmanaged class get the pointer of the delegate(or something like that) of the managed class? any suggestion?

    N 1 Reply Last reply
    0
    • E Elf

      Hi! I have a C++ class with a callback function. Now I wanna use this class in .NET enviroment. So according the guide, i wrap it in a managed class. But the problem is the callback. The unmanaged class must have an ability to callback the managed class. How can the callback function in unmanaged class get the pointer of the delegate(or something like that) of the managed class? any suggestion?

      N Offline
      N Offline
      Nish Nishant
      wrote on last edited by
      #2

      See my article :- Implementing Callback functions using IJW (avoiding DllImport) URL - http://www.codeproject.com/managedcpp/cbwijw.asp Desc - Shows how you can call native API functions that require callbacks using IJW, and without the use of DllImport attribute. The technique allows you to pass a delegate as the callback function just as in the MS recommended manner except, I show you how to do this without the ugly DllImport attribute. HTH Regards, Nish


      Author of the romantic comedy Summer Love and Some more Cricket [New Win] Review by Shog9 Click here for review[NW]

      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