sorry.ReplayMessage是回应SendMessage的。
PeekMessage 加 PM_REMOVE不知行不行。
PeekMessage 加 PM_REMOVE不知行不行。
解决方案 »
- 请问#$EC#$01怎么理解
- 大哥们帮个忙:怎样在一个form上按下"del"键执行我Button1上的代码?
- 各位大哥,一个考勤问题,小弟非常迷茫,在此请教!(有比较好的答案就揭贴)
- 将excel表的数据倒到DBGrid上,谁会
- 投诉贴
- 客户段的socket如何实时判断和服务端的socket的连接状态,急。。。
- 在Edit1中只允许输入数字的情况之下,怎么让组合键Ctrl+C和Ctrl+V可以起作用呢?
- .mov文件用什么播放器?
- 在线等着送分给你! 怎样定义API函数?
- 我想让form1消失,可我加了form1.close后就出现了错误,why??在线给分!!!
- delhpi4.0怎样调用EXCELL97数据
- delphi中如何对图象淡入淡出?
BOOL fDone;
MSG msg;
// Begin the operation and continue until it is complete
// or until the user clicks the mouse or presses a key.
fDone = FALSE;
while (!fDone)
{
fDone = DoLengthyOperation(); // application-defined function
// Remove any messages that may be in the queue. If the
// queue contains any mouse or keyboard
// messages, end the operation.
while (PeekMessage(&msg, hwnd, 0, 0, PM_REMOVE))
{ switch(msg.message)
{
case WM_LBUTTONDOWN:
case WM_RBUTTONDOWN:
case WM_KEYDOWN:
//
// Perform any required cleanup.
//
fDone = TRUE;
}
}
}
在DELPHI中要实现消息过滤可用APPLICATION的ONMESSAGE事件来完成,ONMESSAGE处理进入消息队列中消息,若有消息不想执行,可过滤之。DELPHI帮助中事例如下:The following code handles a custom message that the application sends to itself when a file is ready for reading.const
WM_FILEREADY = WM_USER + 2000;
procedure TForm1.FormCreate(Sender: TObject);begin
Application.OnMessage := AppMessage;
end;procedure TForm1.AppMessage(var Msg: TMsg; var Handled: Boolean);
begin
if Msg.message = WM_FILEREADY then
begin
Memo1.Lines.LoadFromFile(StrPas(PChar(Msg.lParam)));
Handled := True; end; { for all other messages, Handled remains False }
{ so that other message handlers can respond }
end;