Thomas, Hi again...
I would like to give you example of my code. I wrote a simple DLL that
works, I have defined, for example (in my unmanaged C++ DLL):
EXAMPLE NO. 1
extern "C" __declspec(dllexport) BOOL CapPreview(HWND hwnd, bool f)
{
return capPreview(hwnd, f); //belongs to the included Vfw.h
}
and from C# i called the DLL function like that:
[DllImport("VidCapDll.dll")]
public static extern bool CapPreview(int hwnd, bool f);
It works !!! and with the other Video Capture functions I am able to capture
video from C#.
Then, I have decided to follow your article and to create a Managed C++ DLL
and to wrap with it an unmanaged C++ Class, for example:
EXAMPLE NO. 2
in the unmanaged class:
class UMClass
{
public:
BOOL CapPreview(HWND hwnd, bool f) {return capPreview (hwnd, f);}
}
in the managed class:
class MClass
{
public:
bool MCapPreview(int hwnd, bool f) { return m_pUMC->CapPreview(hwnd,
f); }
private:
UMClass * m_pUMC;
}
Now, in this case I get a convertion error, the compiler cannot convert the
parameter from INT to HWND (in the first example there was no problem to
send INT from C# to the HWND in the unmanaged DLL).
How can I solve it???
Thanks again
Lio