C # What is the problem with the secondary development of tianmin sdk3000 ?? Solution

Source: Internet
Author: User

 C # What is the problem during the secondary development of the sdk3000 OCX component ?? Solution

This is the trigger condition for dynamic detection.

Private void btnstarttest_click (Object sender, eventargs E)
{
Byte [] bytes = new byte [] {, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 25, 25, 25, 25, 25, 25, 25 };
String mapsize = encoding. ASCII. getstring (bytes );
Int32 imotiondetect = sdk3000apiclass. getmotiondetectdelegate ();

Axsdk3000.enablemotiondetect (mapsize, bytes. length, 10, imotiondetect );

}

Sdk3000apiclass. getmotiondetectdelegate (); this is the result of the obtained pointer:

Public static int32 getmotiondetectdelegate ()
{

Vcaprccbmotiondetectinvoke icpic = new vcaprccbmotiondetectinvoke (vcaprccbmotiondetect );
Return marshal. getfunctionpointerfordelegate (icpic). toint32 ();
}

Here is the delegate statement

Public Delegate void vcaprccbmotiondetectinvoke (INT dwcard, bool bmove, ref int lpcontext );

 

The following is a delegated instance. Every call always says that the referenced memory is written/read, and then it crashes and pulls

I don't know if there is a problem with my parameters, or the method used to delegate the pointer is incorrect. Please help me to see,

At the end of the month to submit projects, urgent ah, my QQ: 379446670, mail: 520philip@163.com

Please help me see

/// <Summary>
/// Dynamic detection callback
/// </Summary>
/// <Param name = "dwcard"> </param>
/// <Param name = "bmove"> </param>
/// <Param name = "lpcontext"> </param>
Public static void vcaprccbmotiondetect (INT dwcard, bool bmove, ref int lpcontext)
{
MessageBox. Show ("messageboxshow! ");
}

**************************************** **************************************** ***********

Below is how to use DLL

**************************************** **************************************** ***********

If the com method does not work, I will use the method called by C ++ DLL, but the result is still problematic.

Public static int motiondetecti (INT ncards, bool benadetect, byte [] pareamap, long nsizeofmap, long npersisttime, ref string lpcontext)
{
Vcaprccbmotiondetectinvoke icpic = new vcaprccbmotiondetectinvoke (vcaprccbmotiondetect );
Return vcaenablemotiondetect (ncards, benadetect, ref pareamap,
Nsizeofmap, npersisttime, ref lpcontext, icpic );
}

 

[Dllimport ("sdk3000_7130.dll")]
Public static extern int vcaenablemotiondetect (INT ncards, bool benadetect, ref byte [] pareamap, long nsizeofmap, long npersisttime, ref string lpcontext, vcaprccbmotiondetectinvoke TP );

 

Public Delegate void vcaprccbmotiondetectinvoke (INT dwcard, bool bmove, ref int lpcontext );

 

/// <Summary>
/// Dynamic detection callback
/// </Summary>
/// <Param name = "dwcard"> </param>
/// <Param name = "bmove"> </param>
/// <Param name = "lpcontext"> </param>
Public static void vcaprccbmotiondetect (INT dwcard, bool bmove, ref int lpcontext)
{
MessageBox. Show ("messageboxshow! ");
}

 

There is always a problem with callback ???

 

I hope you can help me. it's too difficult to pull it for two weeks. I don't know how it looks. The end of the month is full.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.