I'm using a C# dll, called from unmanaged C++ through a COM Interop interface. I open a window in C++ and want to handle it from C#, which I already do using user32 dll and FindWindow, GetWindowHandleByProcessID etc methods.
Since the current solutions don't seem to be 100% reliable - I mean on the uniqueness of retrieving the window handle - the best would be to marshall the HWND type from unmanaged to IntPtr to the managed code. All my reasearch have been unfruitful so far. I've found that the HWND object is opaque; however it is in a binary format and it should be some way to pass it from Win32 to .net somehow.
Many thanks for your contributions!