随笔 - 137  文章 - 3 评论 - 95 阅读 - 54万

.net调用动态库NationECCode.dll使用电子凭证二维码解码接口

 

C#.net调用示例代码:

复制代码
        [DllImport("NationECCode.dll", CallingConvention = CallingConvention.StdCall)]
        public static extern void NationEcTrans(string url, string input, IntPtr output);

        public static string inOut(string url, string input)
        {
            IntPtr outPut = System.Runtime.InteropServices.Marshal.AllocHGlobal(2048);
            NationEcTrans(url, input, outPut);
            string retStr = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(outPut);
            System.Runtime.InteropServices.Marshal.FreeHGlobal(outPut);
            return retStr;
        }

        static void Main(string[] args)
        {
            string toUrl = "http://172.16.33.247/localcfc/api/hsecfc/localQrCodeQuery";
            string inPut = "{\"data\":{\"businessType\":\"01203\",\"deviceType\":\"\",\"officeId \":\"32760\",\"officeName\":\"123\",\"operatorId\":\"test001\",\"operatorName\":\"456\",\"orgId\":\"35020319001\"},\"orgId\":\"35020319001\",\"transType\":\"ec.query\"}";
            
            string outPut= inOut(toUrl, inPut);
            Console.WriteLine("出参:"+ outPut);

            Console.Read();
        }
复制代码

 

测试解码正常。

 

posted on   yi-sheng  阅读(1730)  评论(2编辑  收藏  举报
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 【杭电多校比赛记录】2025“钉耙编程”中国大学生算法设计春季联赛(1)
点击右上角即可分享
微信分享提示