程序运行时,第一次得到[随机码]是正常的,但是为了更好的表现出这个控件
的功能,可以点击[随机码]图,可再次随机得到随机码,问题:在以后的情况下
不定时的出错,提示信息如下:
1)Access violation at address 00401e58 in module 'PorSJMRZ.exe'.
     Write of address 0000001e
  Access violation at address 003821cc in module 'PorSJMRZ.exe'.
     Write of address 00000014
  Access violation at address 00382184 in module 'PorSJMRZ.exe'.
     Write of address 00000024
2)"0x00383132"指令引用的"0x00a5335c"内存,该内存不能为"read"
3)Runtime error 216 at 00383132

解决方案 »

  1.   

    下面是我的DLL库文件头:
    ==========================================
    Library RandomDPRS;{ 定义产生随机码的位数[默认8位]. }
    uses
      Windows,  Messages,  SysUtils, Variants, Classes, Graphics, Controls,
      Forms, Dialogs,StdCtrls, ExtCtrls, Buttons;
    {$R *.res}
    function RandomDPRS1(var img:Timage):string;stdcall;
    var
      I,j,k:   Integer;
      vPoint:   TPoint;
      

  2.   

    如果在dll中使用了string类型,那uses 的第一个单元一定是ShareMem,否则会出现内存管理混乱。
    最好的办法就是不用string,用pcharfunction RandomDPRS1(var img:Timage):pchar;stdcall;或者 uses  shareMem,......
      

  3.   

    你把调用的代码和dll函数的代码贴出来啊  
    看看出错误提示的上一步做了什么  
      

  4.   

    高手在吗,请教一个问题,我编写了一个DLL文件返回的是字符型值,为什么第一次运行
    没有问题,再在程序中点击数次后就出错了呀,错误信息如下:
    不定时的出错,提示信息如下: 
    1)Access violation at address 00401e58 in module 'PorSJMRZ.exe'. 
        Write of address 0000001e 
      Access violation at address 003821cc in module 'PorSJMRZ.exe'. 
        Write of address 00000014 
      Access violation at address 00382184 in module 'PorSJMRZ.exe'. 
        Write of address 00000024 
    2)"0x00383132"指令引用的"0x00a5335c"内存,该内存不能为"read" 
    3)Runtime error 216 at 00383132 
      

  5.   

    把你的动态库及调用动态库的代码贴出来。这样大家才好帮助你·
    具体访问DLL内存出错。2楼已经给你答案了/
      

  6.   


    var
      I,j,k:   Integer;
      vPoint:   TPoint;
      

  7.   

    function RandomDPRS1(var img:Timage):string;stdcall;
    var
      I,j,k:   Integer;
      vPoint:   TPoint;
      

  8.   

    function RandomDPRS1(var img:Timage):pchar;stdcall;