当用户自定义消息时,消息处理函数也定义好了,可是windows怎么知道什么时候触发该消息,调用该函数呢?怎么知道的呢,它又不是系统自带的?怎么知道的呢?
解决方案 »
- 租了个房子,有两台电脑,一个路由器,我该怎么办?
- ADO 登陆的问题!
- 存储过程就一个参数,而且是返回参数为什么都得不到呢?》提示没有过程ProcGet_ENO需要参数,@tempENO,但未提供参数
- 有谁知道 winrar文件结构
- 怎么样将值传递给弹出来的窗体?
- 如何调用函数及过程?
- 'changegrid'是什么东东
- 在2000中如何屏蔽Ctrl+Alt+Del等系统功能键,HOOK似乎不行
- 怎样将数据库中的图象字段放入WORD中!!!(在线等待)
- 关于treeview里节点选取的问题
- DELPHI如何产生按键的消息给特定的进程,或者给全部进程?
- d5打开D4的程序,报Error Creating Form:发生意外错误!可是在NT下的D5就不会,98下就会,为什么呢?怎么回事啊?
UINT Msg, // message to send
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
);
ParametershWndIdentifies the window whose window procedure will receive the message. If this parameter is HWND_BROADCAST, the message is sent to all top-level windows in the system, including disabled or invisible unowned windows, overlapped windows, and pop-up windows; but the message is not sent to child windows. MsgSpecifies the message to be sent. wParamSpecifies additional message-specific information. lParamSpecifies additional message-specific information. Return ValuesThe return value specifies the result of the message processing and depends on the message sent.
private
{ Private declarations }
procedure MouseMessage(var Message: tMessage); message MouseMsg;//MouseMsg为你要处理的消息类型procedure TForm1.MouseMessage(var Message: TMessage);
begin
//处理代码
end;
procedure mousemessage(var message: tmessage); message MouseMsg;
//Message 后添加你要处理的消息类型procedure mousemessage(var message: tmessage); message MouseMsg;
begin
//你要处理的代码
end;
具体可以看看开发人员指南上,专门有一章讲消息的~
使用SendMessage PostMessage等 自己给他发送消息
原因是系统还有些消息要发给窗口处理函数。可参见windows程序设计方面的书。
需要处理消息时,通过SendMessage或PostMessage触发消息
如:CONST WM_OVER=WM_USER+$1000
SendMessage(frmmain.Handle,WM_OVER,0,0)