USB Analogue video capture - C++ plugin (1 Viewer)

dmxlight

New Member
March 16, 2012
2
0
Home Country
England England
Hello,

Many years ago I wrote in Pascal, more recently I have been learning C++ using Visual Studio 2010.
I have a stand alone video recorder app I wrote in C++ to copy my old video tapes onto mpeg.
I am planning to integrate this app into a MP plugin.
I have created a dll in C# from the tutorial on the MP wiki, this works ok, it reads the author and captures button presses.
I have converted that C# code to C++ and compiled a new dll, MP see's the dll, it reads the author and plugin name ok, but the problem is that the dll will not capture the button presses from MP.
I am sure I have made a simple mistake but I cannot figure it out.

I looked on the forum for C++ example code but could not find any, so when I am finished I will submit mu code as an example for others wanting to use C++ for dll's.

The code I have for capturing the buttons onclick events is shown below.
I have only pasted just the button related code to keep the post short, I am sure I have just missed a ^ or : somewhere.

C++ .h file

public ref class Class1 : GUIWindow, ISetupForm
{
public:
[SkinControlAttribute(2)] GUIButtonControl ^buttonOne;

public:
virtual void OnClicked(int controlId, GUIControl ^control, MediaPortal::GUI::Library::Action::ActionType ^actionType) override;

private:
void OnButtonOne();


C++ .cpp file

void Class1::OnClicked(int controlId, GUIControl ^control, MediaPortal::GUI::Library::Action::ActionType ^actionType)
{
if (control == buttonOne) OnButtonOne();
GUIWindow::OnClicked(controlId, control, *actionType);
}

void Class1::OnButtonOne()
{
MessageBox::confused:how("button one clicked");
GUIDialogOK ^dlg = safe_cast<GUIDialogOK^>(GUIWindowManager::GetWindow(safe_cast<int>(GUIWindow::Window::WINDOW_DIALOG_OK)));
dlg->SetHeading("Button has been pressed");
dlg->SetLine(1, "You pressed button 1");
dlg->SetLine(2, String::Empty);
dlg->SetLine(3, String::Empty);
dlg->DoModal(GUIWindowManager::ActiveWindow);
}

Many thanks,
Mike
 

Users who are viewing this thread

Top Bottom