DELPHI中的DLL动态调用参数那里不对呀???
原题意是静态方式的:
公共单元 Commpub.pas
声明如下:
    //系统登陆图片
    function GetLogoPic: TGraphic; stdcall;external 'LOGOPIC.dll';
    //用户权限标题图
    function GetSYSQXBTS: TGraphic; stdcall;external 'LOGOPIC.dll';
    //RzPageControl1中的LOGO图片
    function GetImageJPG: TGraphic; stdcall;external 'LOGOPIC.dll';
    //ImageTel 手机号码玄机算标题
    function GetImageTel: TGraphic; stdcall;external 'LOGOPIC.dll';
    //ImageTel 手机号码玄机算吉字标识
    function ImageTelBS:  TGraphic; stdcall;external 'LOGOPIC.dll';
在窗体中引用的方式如下:
Image2.Picture.Graphic:=GetImageJPG;
但是现在的问题如何修改成“动态”方式加载这个DLL文件
这个DLL中引用了五次
最好能加上这个结构
case  参数  of
   参数1:
     begin
     end;
   参数2:
     begin
     end;
   参数3:
     begin
     end;
   参数4:
     begin
     end;
   参数5:
     begin
     end;
end;

解决方案 »

  1.   

    我现在修改成如下格式:
    function GetImageJPG: TGraphic;
    type
       //RzPageControl1中的LOGO图片
       //function GetImageJPG: TGraphic; stdcall;external 'LOGOPIC.dll';
       TGetImageJPG=function:TGraphic;stdcall;
    const
      Dll_LOGOPIC = 'LOGOPIC.dll';
    var
      fdll: string;
      getImage: TGetImageJPG;
      h: THandle;
    begin
      fdll := ExtractFilePath(ParamStr(0)) + Dll_LOGOPIC;
      if FileExists(fdll) then
      begin
        h := LoadLibrary(pChar(fdll));
        if h<>0 then
        try
         begin
          @getImage := GetProcAddress(h, 'GetImageJPG');
          Result := getImage();
         end;
        finally
          begin
           FreeLibrary(h);
           Application.MessageBox(PChar('文件错误或者文件损坏'),'错误信息:',MB_ICONERROR);
           //close;
           Application.Terminate;
          end;
        end;
      end;
    end;
    //=======================================================
    function GetImageJPG: TGraphic;
    [错误] usedll.pas(155): '=' expected but '.' found
    [错误] usedll.pas(155): '.' expected but ';' found
      

  2.   

    function GetImageJPG: TGraphic;
    [错误] usedll.pas(155): '=' expected but '.' found
    [错误] usedll.pas(155): '.' expected but ';' found
      

  3.   

    'LOGOPIC.dll'
    库文件方式EXE调用
    问题已解决