无法加载 DLL”sms.dll”:内存位置访问无效

.Net技术 码拜 9年前 (2014-12-09) 2204次浏览 0个评论

最近在做短信发送功能,用的是GPRS,程序调试的时候,总是提示sms.dll 内存位置访问无效,要不就是直接程序死掉。请大家帮忙看看问题到底出在哪里,从网上看的哪些资料都不能解决。也可能是dll的问题,大家谁有sms.dll帮忙发一个。邮箱struggle_wj@163.com,谢谢了
附上代码
动态链接库的

 
[STAThread]
        [DllImport("sms.dll", EntryPoint = "Sms_Connection")]
        public static extern uint Sms_Connection(string CopyRight, uint Com_Port, uint Com_BaudRate, out string Mobile_Type, out string CopyRightToCOM);

        [DllImport("sms.dll", EntryPoint = "Sms_Disconnection")]
        public static extern uint Sms_Disconnection();

        [DllImport("sms.dll", EntryPoint = "Sms_Send")]
        public static extern uint Sms_Send(string Sms_TelNum, string Sms_Text);

        [DllImport("sms.dll", EntryPoint = "Sms_Receive")]
        public static extern uint Sms_Receive(string Sms_Type, out string Sms_Text);

        [DllImport("sms.dll", EntryPoint = "Sms_Delete")]
        public static extern uint Sms_Delete(string Sms_Index);

        [DllImport("sms.dll", EntryPoint = "Sms_AutoFlag")]
        public static extern uint Sms_AutoFlag();

        [DllImport("sms.dll", EntryPoint = "Sms_NewFlag")]
        public static extern uint Sms_NewFlag();

我自己写的

  /// <summary>
        /// 开始短信服务,连接
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        private void button1_Click(object sender, EventArgs e)
        {
            //Thread thread = new Thread(new ThreadStart(Start));
            //thread.Name = "GPRS";
            //thread.IsBackground = true;
            //thread.Start();
            string TypeStr = "wavecom";
            string CopyRightToCOM = "";
            string CopyRightStr = "modem.COM8";
            for (uint j = 1; j < 10; j++)
            {
                //运行到这块就报错了
                uint i = SMS.Sms_Connection(CopyRightStr, (uint)j, (uint)9600, out TypeStr, out CopyRightToCOM);
                if (i == 1)
                {
                    MessageBox.Show("成功!");
                }
                else
                {
                    MessageBox.Show("失败");
                }
            }
        }

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明无法加载 DLL”sms.dll”:内存位置访问无效
喜欢 (0)
[1034331897@qq.com]
分享 (0)

文章评论已关闭!