线程里面需要建立消息循环,不知道你建了没有, var m_TMsg:TMsg; //消息句柄 begin PeekMessage(m_TMsg,0,WM_USER,WM_USER,PM_NOREMOVE); //类似这样的MsgWaitForMultipleObjects等待函数 while PeekMessage(m_TMsg,0,0,0,PM_REMOVE) do begin if m_TMsg.hwnd = 0 then begin case m_TMsg.message of .... end; end else begin DispatchMessage(m_TMsg); end; end; end; 类似这样的
有啊,我的消息循环代码是这样: PeekMessage(Msg, 0, WM_USER, WM_USER, PM_NOREMOVE); while not Terminated do begin if PeekMessage(Msg,0,0,0,PM_REMOVE)then case Msg.Message of ..... end; end;
var
m_TMsg:TMsg; //消息句柄
begin
PeekMessage(m_TMsg,0,WM_USER,WM_USER,PM_NOREMOVE);
//类似这样的MsgWaitForMultipleObjects等待函数
while PeekMessage(m_TMsg,0,0,0,PM_REMOVE) do
begin
if m_TMsg.hwnd = 0 then
begin
case m_TMsg.message of
....
end;
end else
begin
DispatchMessage(m_TMsg);
end;
end;
end;
类似这样的
PeekMessage(Msg, 0, WM_USER, WM_USER, PM_NOREMOVE);
while not Terminated do begin
if PeekMessage(Msg,0,0,0,PM_REMOVE)then
case Msg.Message of
.....
end;
end;