程序为:
library rundll;uses
  Windows,
  forms,
  Messages,
  SysUtils;
{$R *.res}procedure showmess; stdcall; export;
begin
  application.messagebox('哈哈,可以用了!','提示',64);
end;exports
  showmess ;
beginend.用RUNDLL32.exe rundll.dll,showmess执行,可正常运行,点“确定”后就出现RUNDLL32错误
出错的信息:RUNDLL32 在 00de:00000005 的模块
 <未知> 中导致无效页错误。
Registers:
EAX=00000000 CS=018f EIP=00000005 EFLGS=00010287
EBX=81dff6f6 SS=0197 ESP=0063fde0 EBP=00000001
ECX=30b472ef DS=0197 ESI=00400000 FS=6fd7
EDX=bffc9a90 ES=0197 EDI=00000f28 GS=0000
Bytes at CS:EIP:
10 00 00 71 01 00 00 65 04 70 00 65 04 70 00 54 
Stack dump:
00400000 00000000 81dff6f6 00000001 81e01c4c 00000044 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

解决方案 »

  1.   

    >>.application.messagebox('哈哈,可以用了!','提示',64);
    改為 ShowMessage('XXX');
    呢??uses Dialogs;
      

  2.   

    楼主还加一个classes类如果还出错,估计是楼主在释放DLL资源的时候出的问题
      

  3.   

    在dos方式下运行RUNDLL32.exe rundll.dll,showmess
    可正常运行,点“确定”后就还是出现RUNDLL32错误XXSingle(水连天)  我加了还是出错了
      

  4.   

    Application对象其实也就是显示在任务栏里的“窗口”,不去初始化,其窗口句柄应该是无效的,而在用Application.MessageBox、ShowMessage等函数时都将用到该句柄,所以会出错。我认为如果在library rundll里添加两句代码可能就可以了,条件有限,没做测试:
    export
    ...
    begin
      Application.Initialize;
    end.
    或者,按naughtyboy的建议,应该也可以。简单一点,可以这么写:
    MessageBox(nil, '哈哈,可以用了!','提示',MBxxx);
      

  5.   

    我试过用MessageBox(nil, '哈哈,可以用了!','提示',MB_ok);
    试过了,不行的
      

  6.   

    zhengji(看雨飞) 说的,我试了,没有成功!错误依旧
      

  7.   

    uses 中添加 sharemem; 试一下
      

  8.   

    工程和单元文件的uses力都加上sharemen,并且放在第一个位置。
      

  9.   

    不要用Application.messagebox换一个吧
      

  10.   

    老实说。..DLL里我都没用过PROCEDURE .............
      

  11.   

    如果在uses 中添加 sharemem
    2000 用RUNDLL32.exe rundll.dll,showmess执行 出错,
    出现“rundll32.exe-应用程序错误”
    提示“"0x00000000"指令引用的"0x00000000"内存。该内存不能为"read"。”
    98 用RUNDLL32.exe rundll.dll,showmess执行 出错,
    出现rundll出错
    提示“装载rundll.dll时出错,找不到运行此应用程序所需的某个库文件。”
      

  12.   

    我的没有出现错误:(2000下,98下没有试验)
    library mydll;{ Important note about DLL memory management: ShareMem must be the
      first unit in your library's USES clause AND your project's (select
      Project-View Source) USES clause if your DLL exports any procedures or
      functions that pass strings as parameters or function results. This
      applies to all strings passed to and from your DLL--even those that
      are nested in records and classes. ShareMem is the interface unit to
      the BORLNDMM.DLL shared memory manager, which must be deployed along
      with your DLL. To avoid using BORLNDMM.DLL, pass string information
      using PChar or ShortString parameters. }uses
      SysUtils,Dialogs,
      Classes;
    procedure showmess; stdcall; export;
    begin
       MessageDlg('哈哈,可以用了!', mtInformation,[mbOk], 0);
    end;
    {$R *.res}
    exports
      showmess ;
    beginend.
      

  13.   

    IUPRG(遨云驰行,琢符弄图) 
    你那样的,在98一定和我一样的错误,
    你的程序在2000不会错,我的也一样
      

  14.   

    stdcall和export说明去掉就可以了。另外可以如此,
    application.handle := handle; 此句可选加入,这样就会使它门处于同一个进程中。
    ShowMessage("js;lf");绝对不会报错。
      

  15.   

    khzide(秦始皇)   
    library mydll;{ Important note about DLL memory management: ShareMem must be the
      first unit in your library's USES clause AND your project's (select
      Project-View Source) USES clause if your DLL exports any procedures or
      functions that pass strings as parameters or function results. This
      applies to all strings passed to and from your DLL--even those that
      are nested in records and classes. ShareMem is the interface unit to
      the BORLNDMM.DLL shared memory manager, which must be deployed along
      with your DLL. To avoid using BORLNDMM.DLL, pass string information
      using PChar or ShortString parameters. }uses
      SysUtils,Dialogs,
      Classes;
    procedure showmess; 
    begin
       MessageDlg('哈哈,可以用了!', mtInformation,[mbOk], 0);
    end;
    {$R *.res}
    exports
      showmess ;
    beginend.在98下还是会出错的。
    不信你试一下。真搞不明白3721 是怎么搞出来,不会出错的。
    郁闷中
      

  16.   

    將妳調用DLL的工程的APPLICATION.HANDLE传过来不就得了,
    DLL连FORM都能SHOW,何况是个消息呢。
      

  17.   

    用RUNDLL32.exe rundll.dll,showmess执行,可正常运行,点“确定”后就出现RUNDLL32错误