我在DLL库中定义了一个函数
function  chage(a:string);integer;stdcall;
begin
Screen.cursor:=crhourclass;
//执行代码
........
end;为什么我在宿主程序中调用这个DLL中的函数,鼠标状态并没有改变,这是为什么啊?

解决方案 »

  1.   

    1、让DLL跟EXE共享RTL,
    2、DLL导出:
    function DLLCursor(): Integer; stdcall;
    begin
      Screen.Cursor := crHourGlass;
    end;exports
      DLLCursor;3、在EXE中调用:type
      TDLLCursor = function (): Interger; stdcall;procedure TForm1.Button1Click(Sender: TObject);
    var
      FFunc: TDLLCursor;
    begin
      // 取得DLL入口函数地址
      FFunc := TDLLCursor(TSystemFunc.Instance.GetLibProcAddress('Project2.dll', 'DLLCursor'));
      if Assigned(FFunc) then
        FFunc();
    end;应该没有多大问题吧??
      

  2.   

    [Error] Unit_Registration.pas(1357): Undeclared identifier: 'TSystemFunc',这是怎么回事啊?type
      TDLLCursor = function (): Interger; stdcall;这是什么调用方法啊?
      

  3.   

    晕,TSystemFunc是我这里的一个类,我不都写了么,TSystemFunc.Instance.GetLibProcAddress()这个函数只是取DLL中函数入口,type
    TDLLCursor = function (): Interger; stdcall;// 函数类型指针
      

  4.   

    各位大哥,你们所说的太高深了,我看不明白呀,我真佩服你们,我是delphi的新手,才刚刚起步,以后有问到你们的地方请多多关照