   Using my C++ engine (with win32 parts) in C#
  I've created sort of an engine in C++, which I want to use for a game project. However, I would like to do the map editor in C#. For this I'd still require access to my engine, which is a library. Now, I've read about P/Invoke, and writing wrapped managed classes or something so I can call my Native classes in C#. I foresee one problem though. My engine is heavily based on a Window Manager module that I use to create windows, handle messages, etc. Obviously all this is Win32 based, C++ code.Since it is present in initialization, but also the main loop is based on handling messages through the window manager's callback, I think it would be a pain to remove this.Is there any way I would be able to make this work in C#? Would it require removing the window manager, which means I have to rewrite my main loop, or can it be done some other, clever way?   