procedure TfrmPlayMain.RunMode;
var
  actcmd:string;
  dllName:string;
  dllH:THandle;
  appPath:string;
  ActionCmd:TActionCmd;
  i:integer;
  CmdLoc:TCmd;
begin
    appPath:=extractFilePath(application.ExeName);
    for i:=0 to Length(DLLInfo)-1 do
    begin
    dllH := loadlibrary(pchar(appPath+DLLInfo[i].DLLName));
    DLLInfo[i].handle:=  dllH;
    @CmdLoc:= windows.getProcAddress(dllH,pchar('CreateForm'));     
      try
        CmdLoc(DLLInfo[i].LocX,DLLInfo[i].LocY,Application,conAdo);
      finally
        CmdLoc := nil;
      end;
    end;
end;
想通过多线程调用一组DLL,不知道如何调用?谢谢

解决方案 »

  1.   

    你是指一个线程序调用一个DLL,还是在一个线程里调用所有的DLL
      

  2.   

    写一个类继承TThread
    在Execute里去调用这个函数
      

  3.   

    想用一个线程序调用一个DLL,谢谢
      

  4.   

    for i:=0 to Length(DLLInfo)-1 do
        begin
        dllH := loadlibrary(pchar(appPath+DLLInfo[i].DLLName));
        DLLInfo[i].handle:=  dllH;
        TDllThread.Create(dllh,true); 
        end;把Handle当成TThread的子类的参数传入
    TDllThread = class(TThread)
    private
       FHandle: THandle;
    public
       constructor Create(AHandle: THandle; B: Boolean);
       procedure Execute;override;
    end;procedure TDllThread.Execute;
    begin
      ...
    end;
      

  5.   

    constructor RunDLL.Create(AHandle: THandle; B: Boolean);
    begin
      FHandle:=  AHandle;****end;
    请问这里为什么不能赋值?会报错
      

  6.   

    Project PlayScreen.exe raised exception class EAccessViolation
    with message 'Access violation at address 00403721 in module
    'PlayScreen.exe'. Read of address 0000000 Process stopped.
    Use Step or Run to continue谢谢