|
Posted by Rab on August 28, 2008, 2:42 am
Please log in for more thread options
Hi all,
I developped a directShow filter in Windows Mobile that successfuly
processes and render video frames inside a C# application.
My filter graph is : CameraCaptureFilter->MyProcessingFilter-
>RenderFilter.
I now want to call a C# method from my C++ transform filter to show a
dialog box for example.
I succeeded to call this C# method from a C++ method outside my filter
graph using a C# delegate and Interop C#/C++.
But when I call this same C# method from my directShow filter, it
freezes my application instead.
Why is it working from a dll function and not from the directShow
processing filter function if you know?
--------- Begin Form1.cs ---------
[DllImport("myDLL.dll")]
private extern static bool initCallBack(ReportBackHere callBack);
public delegate void ReportBackHere(int x, int y, int z);
(...)
private void InitializeApp()
{
ReportBackHere myCallBack = new ReportBackHere(Form1.
myFunction);
initCallBack(myCallBack);
(...)
}
(...)
public static void myFunction(int x, int y, int z)
{
MessageBox.Show("My callback function has been called from C++ !! ");
(...)
}
--------- End Form1.cs ---------
--------- Begin myDLL.cpp ---------
typedef void (CALLBACK *myPrototype)(int, int, int);
void (*myFunctionPointer)(int, int, int) = NULL;
extern "C" bool __declspec(dllexport) initCallBack(myPrototype dm)
{
myFunctionPointer = dm;
return true;
}
//CMonoFilter Class
HRESULT CMonoFilter::Transform(
IMediaSample *pIn,IMediaSample *pOut)
{
(...)
//here i call my function
(*myFunctionPointer)(20, 40, 0);
}
--------- End myDLL.cpp ---------
thanks for your help.
|