Jump to content

C# Wrapper für DVBViewer Plugins


Recommended Posts

Interesting project design. But wouldn't it as well be possible to just create two projects in a VS solution, a C++ and a C# one, have them built as usual and add a [project reference to the C# project] to the C++ project? Would that result in two separate assembly files or just a single DLL for the C++ project? (I haven't worked with such multi-language solutions before.)

 

Oh, and you can't create OSD plugins with this yet, can you? Just wondering about the missing COM interfaces in the C# section. This actually looks like a "regular" (unmanaged?) C++ plugin that can make use of .NET additions for certain tasks. But again, I'm not a managed C++ expert...

 

(Grouping brackets added for readability reasons.)

(Mit Deutsch wär das zur Abwechslung nicht passiert. :blush:)

Link to comment
But wouldn't it as well be possible to just create two projects in a VS solution, a C++ and a C# one, have them built as usual and add a [project reference to the C# project] to the C++ project? Would that result in two separate assembly files or just a single DLL for the C++ project?

It should be possible, but as a multi-dll solution.

 

Oh, and you can't create OSD plugins with this yet, can you? Just wondering about the missing COM interfaces in the C# section. This actually looks like a "regular" (unmanaged?) C++ plugin that can make use of .NET additions for certain tasks.

You are right. The OSD-part is a outstanding task. I'm working on a C++-port of the Delphi OSD-COM sample source as you do for C#. Now (see the other thread) i'm hopeful you can contribute the port for C# and so this OSD stuff can be done in the C# part of this wrapper. BTW the C++ plugin is regular but managed (CLI).

 

erwin

Link to comment

I've just tried to compile it with Visual Studio 2005, after altering the version number in the sln and vcproj files. Here's the build error output:

 

1>------ Erstellen gestartet: Projekt: DVBViewerPlugin, Konfiguration: Debug Win32 ------
1>Generate temp.netmodule
1>c:\KB\Computer\Source\DVBVC#\DVBViewerPlugin\C#\Source1.cs
1>c:\KB\Computer\Source\DVBVC#\DVBViewerPlugin\C#\Source2.cs
1>		1 Datei(en) kopiert.
1>Microsoft (R) Visual C# 2005, Compilerversion 8.00.50727.3053
1>für Microsoft (R) Windows (R) 2005 Framework, Version 2.0.50727
1>Copyright (C) Microsoft Corporation 2001-2005. Alle Rechte vorbehalten.
1>warning CS1668: Ungültiger Suchpfad C:\Programme\Microsoft Visual Studio 8\VC\atlmfc\lib\i386 in LIB-Umgebungsvariable -- Das System kann den angegebenen Pfad nicht finden. .
1>warning CS1668: Ungültiger Suchpfad C:\Programme\Microsoft Visual Studio 8\lib in LIB-Umgebungsvariable -- Das System kann den angegebenen Pfad nicht finden. .
1>Kompilieren...
1>DVBViewerPlugin.cpp
1>.\C++\DVBViewerPlugin.cpp(121) : warning C4793: "Deklaration innerhalb von #pragma unmanaged.": Systemeigener Code für die void doIt(void)-Funktion wird generiert.
1>		.\C++\DVBViewerPlugin.cpp(105): Siehe Deklaration von 'doIt'
1>.\C++\DVBViewerPlugin.cpp(122) : error C3821: "DVBViewerPlugin::Source1 ^": Ein verwalteter Typ oder eine verwaltete Funktion kann nicht in einer nicht verwalteten Funktion verwendet werden.
1>.\C++\DVBViewerPlugin.cpp(122) : error C3821: "DVBViewerPlugin::Source1": Ein verwalteter Typ oder eine verwaltete Funktion kann nicht in einer nicht verwalteten Funktion verwendet werden.
1>.\C++\DVBViewerPlugin.cpp(122) : error C3642: 'DVBViewerPlugin::Source1::Source1(void)' : Mit der __clrcall-Aufrufkonvention aus systemeigenem Code kann keine Funktion aufgerufen werden.
1>.\C++\DVBViewerPlugin.cpp(122) : error C3175: 'DVBViewerPlugin::Source1::Source1': Eine Methode eines verwalteten Typs kann nicht von einer nicht verwalteten Funktion 'doIt' aufgerufen werden
1>.\C++\DVBViewerPlugin.cpp(123) : error C3821: "src1": Ein verwalteter Typ oder eine verwaltete Funktion kann nicht in einer nicht verwalteten Funktion verwendet werden.
1>.\C++\DVBViewerPlugin.cpp(123) : error C3821: "DVBViewerPlugin::Source1::ShowMessage": Ein verwalteter Typ oder eine verwaltete Funktion kann nicht in einer nicht verwalteten Funktion verwendet werden.
1>.\C++\DVBViewerPlugin.cpp(123) : error C3821: "System::String": Ein verwalteter Typ oder eine verwaltete Funktion kann nicht in einer nicht verwalteten Funktion verwendet werden.
1>.\C++\DVBViewerPlugin.cpp(123) : error C3642: 'void DVBViewerPlugin::Source1::ShowMessage(System::String ^)' : Mit der __clrcall-Aufrufkonvention aus systemeigenem Code kann keine Funktion aufgerufen werden.
1>.\C++\DVBViewerPlugin.cpp(123) : error C3175: 'DVBViewerPlugin::Source1::ShowMessage': Eine Methode eines verwalteten Typs kann nicht von einer nicht verwalteten Funktion 'doIt' aufgerufen werden
1>Das Buildprotokoll wurde unter "file://c:\KB\Computer\Source\DVBVC#\DVBViewerPlugin\Debug\BuildLog.htm" gespeichert.
1>DVBViewerPlugin - 9 Fehler, 1 Warnung(en)
========== Erstellen: 0 erfolgreich, Fehler bei 1, 0 aktuell, 0 übersprungen ==========

 

It doesn't like the managed/unmanaged thing at all it seems. Any idea?

Link to comment

Visual Studio 2005 with errors - 2008 without. Strange!

Maybe because the declaration of doIt() is in the scope of the "#pragma unmanaged" and the definition is in the scope of "#pragma managed"? Try to rearrange parts of the code or insert "#pragma managed" before the doIt() declaration and "#pragma unmanaged" after it.

 

erwin

Link to comment

I removed the forward declaration of doIt() and moved the doIt function implementation to its place, surrounded by #pragma {,un}managed. That did the trick. The plug-in did successfully compile and run.

Link to comment
  • 7 months later...

EXPRESS Ja oder nein.

 

Die Solution ist eine Mischsprachen (C++ und C#)-Lösung. Sollte also unter EXPRESS-Versionen (die ja jeweils nur eine Sprache unterstützen) nicht gehen.

 

erwin

Link to comment
  • 7 months later...

uralter thread, aber was kann man damit machen?

 

mangels delphi und delphi kenntnissen kam ich bisher nicht in das vergnügen ein plugin zu schreiben ;-)

 

ist es damit möglich per c# und visual studio die com schnittstelle anzusprechen?

 

mehr bräuchte ich nämlich nicht....

 

MFG Vino

Edited by VinoRosso
Link to comment

uralter thread, aber was kann man damit machen?

 

mangels delphi und delphi kenntnissen kam ich bisher nicht in das vergnügen ein plugin zu schreiben ;-)

 

ist es damit möglich per c# und visual studio die com schnittstelle anzusprechen?

 

mehr bräuchte ich nämlich nicht....

 

MFG Vino

 

Das geht mit C# oder auch C++ auch ohne das Plugin Framework. In C# einfach das DVBViewer Interface einbinden. Dann kann man die COM Schnittstelle z.B. so ansprechen:

 

DVBViewer dvb = (DVBViewer)System.Runtime.InteropServices.Marshal.GetActiveObject("DVBViewerServer.DVBViewer");

dvb.OSD.ShowInfoinTVPic("Testmessage", 3000);

 

Such mal in diesem Unterforum. Es gibt einige Beispiele, wie man das COM-Interface per C#, C++, VB-Script oder auch AutoIt anspricht.

Link to comment

Ja aber dann muss man mein Programm extra starten. that suxx

 

ein Plugin wird mit dem Viewer gestartet, das ist was ich möchte....

 

und sowas ist imho momentan nur mit delphi möglich, und dat habsch ned.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...