在线程中动态创建BitBtn控件问题异常,请高手请进!(100)

哎,兄弟你今天都没有搞定?Test_Thread = class(TThread) private { Private declarations } protected procedure Execute;
override;
public // 加入: procedure _IShowPic;
end;
Var _ThreadEnd : Boolean = false;procedure Test_Thread._IShowPic;
begin
showPicture('');
end;
procedure Test_Thread.Execute;
begin
{ Place thread code here } FreeOnTermiNate := True;
Syn(_IShowPic);// Syn...忘记了,呵呵! while ((not _ThreadEnd) and GetMessage(msg, 0, 0, 0))do
begin
TranslateMessage(msg);
DispatchMessage(msg);
end;
end;
Form1.OnClose里写:_ThreadEn:=True;
 
to:wql 你的思路是正确的,但是,用了 Syn(_IShowPic);// 这同步的,就不需要用 while ((not _ThreadEnd) and GetMessage(msg, 0, 0, 0))do
了吧??
 
在线程里的代码是不可以动窗口的任何可视控件的,否则必然出错。其实你仔细想想,完全没有必要那么做的。
 
TranslateMessage(msg);
if msg.message=you_quitMsg then
Terminate;
DispatchMessage(msg)这样就可以退出 线程中最好不要有和界面 有关的东西
 
这个问题也基本晓得了还是谢谢大家现在各位请领分
 
多人接受答案了。
 

Similar threads

I
回复
0
查看
623
import
I
I
回复
0
查看
539
import
I
顶部