声明的问题System.IntPtr tud=new System.IntPtr();//<------这里要有参数的参考关于IntPtr的MSDN:ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.2052/cpref/html/frlrfsystemintptrclassctortopic.htm

解决方案 »

  1.   

    com是用c++写的,其中EncryptData2([in]unsigned char *pIn, [in]long *plSize, [out]unsigned char **ppOut),ppOut是指针,返回一个字符串,在c#中使用说明为EncryptData2 ( ref byte,ref int,System.IntPtr ppOut),我给ppOut一个初始值,但怎么运行后,ppOut的值没有变化
    RSAENCRYPTLib.RSEncrypt u=new RSAENCRYPTLib.RSEncryptClass();
    string pwd="gis";
    MemoryStream memstr=new MemoryStream();
    BinaryWriter out1=new BinaryWriter(memstr);
    out1.Write(pwd);
    byte[] buffs=memstr.GetBuffer();
    System.IntPtr tud=new System.IntPtr();
    tud=this.Handle;
    int l=pwd.Length;
    u.EncryptData2(ref buffs[0],ref l ,tud);
      

  2.   

    System.IntPtr tud这句有问题,可能tud为空