am import some dll for create the live video. here myprob is i have c++ code like
int PLAYER_SDK_SPEC CreatePlayer( HWND hWndParent, RECT& rectPlayer, const char* szWndTitle );
in c# i have import dll like
[DllImport(“PlayerLib”)]
public static extern int CreatePlayer(IntPtr Handle, Rectangle RECT, StringBuilder szWndTitle);
am call that funcation like
CreatePlayer( this.Handle, rect, str6);
but it’s generate some unhandled exception… please help me to solve this prob
thanks in advance
I don’t think the P/Invoke declaration is correct. From what I know it should be:
The original version takes a reference to a rectangle, so you should do the same. Also I’m not sure if the
Rectangletype and theRECTtype of C++ are equal. Maybe you have to declare astruct RECTin C# too.Take a look at pinvoke.net. There you’ll find functions that take
RECTparameters too, you’ll find hints there on how to pass a rectangle to a C++ function.