当前位置: 代码迷 >> C# >> c# 调用c++api 参数类型? ()
  详细解决方案

c# 调用c++api 参数类型? ()

热度:93   发布时间:2016-05-05 04:49:39.0
c# 调用c++api 参数类型? (在线等)
CRect rect;
GetClientRect(&rect);
SetRect(&rect, 10, 10, 288, 144);

  DWORD DoResult;   
DWORD Params = 0x00731000 | (DWORD)18;
  RECT  Matrix[512];


 OffsetRect(&rect, 0, 144);
          DoResult = DrawBarcode(0 , L"692345065618", L"A>", L"Arial", 
                     NULL, &rect, Matrix, 8, 24, 4, 24, 0, 0, Params);



------------------------------

此方法 用c#调用该如何传值?  一下代码报错
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

----------------------------------------------------------------------
DrawBarcode(this.Handle, 
                    sb_text, sb_starcode, sb_facename,  null,
                       bound_dc,    matrix_dc,
                    textwidth, texheight, textbobarcode, textquiezone, barinflate, 0, para);

StringBuilder sb_starcode = new StringBuilder(1024);
            sb_starcode.Append(">");
            StringBuilder sb_facename = new StringBuilder(1024);
            sb_facename.Append("Arial");

            StringBuilder sb_buffer = new StringBuilder(1024);

            Buffer_Rect buffer_rect=new Buffer_Rect();
            Bound_Rect bound_dc = new Bound_Rect();  
            Barcodematrix_rect matrix_dc = new Barcodematrix_rect();
            StringBuilder para = new StringBuilder(1024);
            int textwidth = 8; int texheight = 24; int textbobarcode = 4;
            int textquiezone = 24; int barinflate = 0;
------解决思路----------------------
函数类型、类定义等关键信息缺失,无法判断还有什么问题,但是&rect是传指针啊,你调用的时候传值是什么意思?
  相关解决方案