F
flcrack
Unregistered / Unconfirmed
GUEST, unregistred user!
看过了lichengbin大侠的“DLL/ActiveForm中的线程同步处理”还是不知从何下手,试了几十次了,都没成功,请指点!
1、如何在一个DLL中的窗体里加入一个处理WM_NULL消息的处理过程(定义常量为WM_NULL时,delphi提示非法引用),最好有示例。
2、DLL中的窗体无法进行线程同步处理,急啊。。。请看源码:
procedure TClientHandleThread.Execute;
var
Thesize:Integer;
ThtStr:String;
RsltStream: TMemoryStream;
begin
while not Terminateddo
begin
if not MyMain.IdTCPOnline.Connected then
begin
MyMain.ToClientDisconnect;
Break;
end
else
begin
try
ThtStr:=MyMain.IdTCPOnline.ReadLn(EOL);
Thesize:=Strtoint(ThtStr);
if Thesize>0 then
begin
try
RsltStream := TmemoryStream.Create;
MyMain.IdTCPOnline.ReadStream(RsltStream,Thesize,False);
RsltStream.Position := 0;
SetLength(CommandStr, RsltStream.Size);
RsltStream.Read(CommandStr[1], RsltStream.Size);
CommandStr:=DecodeBase64(CommandStr);
RsltStream.Free;
Synchronize(HandleInput);//这里不执行!!!!
Except
MyMain.ToClientDisconnect;
Break;
end;
end;
except
end;
end;
end;
end;
1、如何在一个DLL中的窗体里加入一个处理WM_NULL消息的处理过程(定义常量为WM_NULL时,delphi提示非法引用),最好有示例。
2、DLL中的窗体无法进行线程同步处理,急啊。。。请看源码:
procedure TClientHandleThread.Execute;
var
Thesize:Integer;
ThtStr:String;
RsltStream: TMemoryStream;
begin
while not Terminateddo
begin
if not MyMain.IdTCPOnline.Connected then
begin
MyMain.ToClientDisconnect;
Break;
end
else
begin
try
ThtStr:=MyMain.IdTCPOnline.ReadLn(EOL);
Thesize:=Strtoint(ThtStr);
if Thesize>0 then
begin
try
RsltStream := TmemoryStream.Create;
MyMain.IdTCPOnline.ReadStream(RsltStream,Thesize,False);
RsltStream.Position := 0;
SetLength(CommandStr, RsltStream.Size);
RsltStream.Read(CommandStr[1], RsltStream.Size);
CommandStr:=DecodeBase64(CommandStr);
RsltStream.Free;
Synchronize(HandleInput);//这里不执行!!!!
Except
MyMain.ToClientDisconnect;
Break;
end;
end;
except
end;
end;
end;
end;