C# Wrapper declaration libvlc_media_player_set_hwnd

This forum is about all development around libVLC.
LogainStark
New Cone
New Cone
Posts: 6
Joined: 12 Nov 2010 15:37

C# Wrapper declaration libvlc_media_player_set_hwnd

Postby LogainStark » 12 Nov 2010 16:28

Hello,

I am trying to use VLC player (1.1.4) in a C# Win Form Application

I have stopped using ActiveX version because I encountered many issues : Blue screen when disposing vlc object, some VLC options not available, etc... all of those issues are described in other topics of this forum,

So now I am trying to use a C# wrapper on the libvlc.dll :

many topics on this subject on VideoLan.org are outdated so I started from scratch and made my own DllImports commands from the doxygen documentation
(http://www.videolan.org/developers/vlc/doc/doxygen/html)

But now I am stuck with one of the most basic command :

libvlc_media_player_set_hwnd

which, still from the documentation should work with only 2 parameters : media_player object handle and a window handle

So I tried several syntaxes but this simple one should work:
[DllImport("libvlc")]
static extern void libvlc_media_player_set_hwnd(IntPtr vlcHandle, IntPtr windowHandle);

My problem is that when I compile my project with Visual Studio Express 2008, I get an error message basically saying it does not find this method inside the libvlc.dll, while my other calls to the imported methods seems at least to compile..

Does any one here know the correct and UP TO DATE syntax for this Dllimport command?

thanks in advance

XilasZ
Developer
Developer
Posts: 189
Joined: 16 Jun 2009 20:35

Re: C# Wrapper declaration libvlc_media_player_set_hwnd

Postby XilasZ » 13 Nov 2010 01:49

it should work, i use this in my wrapper (fully updated to v1.1.4) :

Code: Select all

[DllImport("libvlc")] internal static extern void libvlc_media_player_set_hwnd(IntPtr p_mi, IntPtr drawable);

LogainStark
New Cone
New Cone
Posts: 6
Joined: 12 Nov 2010 15:37

Re: C# Wrapper declaration libvlc_media_player_set_hwnd

Postby LogainStark » 13 Nov 2010 09:44

I know that it should work... :-(

I clearly miss something obvious, perhaps in my project declaration or in the way I include libvlc.dll...

Can you send me a concrete simple example, or can I send you mine?

XilasZ
Developer
Developer
Posts: 189
Joined: 16 Jun 2009 20:35

Re: C# Wrapper declaration libvlc_media_player_set_hwnd

Postby XilasZ » 14 Nov 2010 13:30

Even if it's far from a simple example, you can take a look at my sources here : http://fritivi.git.sourceforge.net/git/ ... ivi;a=tree

Upload your project somewhere, i'll take a look.
libvlc.dll doesn't need to be added directly in the project as a reference or anything else, just put the dll in the same folder as your exe.

LogainStark
New Cone
New Cone
Posts: 6
Joined: 12 Nov 2010 15:37

Re: C# Wrapper declaration libvlc_media_player_set_hwnd

Postby LogainStark » 15 Nov 2010 10:06

Thank you very much for your example :

I tried the VideoLan.Interop part from my office with a VisualStudio 2008 professional edition and Windows XP 32 bits and it worked fine....

As I still did not understood the difference with my declaration of the DllImport, I tried also my project and then "Miracle!", it worked fine also.... (even if the result is less complete on my version...)

There must be a small difference between the 2 Visual Studio editions or in the OS (at home I use Windows 7 64 bits)


Thank you again !


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 3 guests