***请问如何用多线程调用这个过程***

bigmingming 2007-03-22 04:43:52
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,不知道如何调用?谢谢
...全文
335 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
bigmingming 2007-03-30
  • 打赏
  • 举报
回复
谢谢
zouqiang122 2007-03-27
  • 打赏
  • 举报
回复
up...
zouqiang122 2007-03-27
  • 打赏
  • 举报
回复
up...
bigmingming 2007-03-24
  • 打赏
  • 举报
回复
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

谢谢
chenzhuo 2007-03-23
  • 打赏
  • 举报
回复
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;
bigmingming 2007-03-23
  • 打赏
  • 举报
回复
想用一个线程序调用一个DLL,谢谢
chenzhuo 2007-03-23
  • 打赏
  • 举报
回复
写一个类继承TThread
在Execute里去调用这个函数
dabaicai 2007-03-23
  • 打赏
  • 举报
回复
把这段代码封装到一个类里面,然后在各个线程里面创建对象,来调用
chenzhuo 2007-03-23
  • 打赏
  • 举报
回复
你是指一个线程序调用一个DLL,还是在一个线程里调用所有的DLL
chenzhuo 2007-03-23
  • 打赏
  • 举报
回复
报什么错?
bigmingming 2007-03-23
  • 打赏
  • 举报
回复
constructor RunDLL.Create(AHandle: THandle; B: Boolean);
begin
FHandle:= AHandle;****

end;
请问这里为什么不能赋值?会报错

1,593

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 网络通信/分布式开发
社区管理员
  • 网络通信/分布式开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧