自定义消息,怎么老是报错啊!郁闷,帮忙啊。(50分)

  • 主题发起人 主题发起人 IdeasWare
  • 开始时间 开始时间
I

IdeasWare

Unregistered / Unconfirmed
GUEST, unregistred user!
#define WM_INITFORM (WM_APP + 100)

protected:
void __fastcall InitForm(TMessage &Message);
EGIN_MESSAGE_MAP
MESSAGE_HANDLER(WM_INITFORM, TMessage, InitForm)
END_MESSAGE_MAP(TForm)
[C++ Error] uOp.h(43): E2303 Type name expected

 
消息的区间不正确
 
[h1]怎么改?楼上的魔鬼老师[/h1]
 
void __fastcall InitForm(TMessage &Message);
>>void __fastcall InitForm(TMessage Message);
 
那样写应该是对的,这是C++ Builder帮助中的内容(我以前做的的相关代码不在手头):
Example: Message handler
Here is the declaration of a message handler for a user-defined message called CM_CHANGECOLOR.
#define CM_CHANGECOLOR (WM_APP + 400)
class TMyControl : public TControl
{
protected:
void __fastcall CMChangeColor(TMessage &Message);
begin
_MESSAGE_MAP
MESSAGE_HANDLER(CM_CHANGECOLOR, TMessage, CMChangeColor)
END_MESSAGE_MAP(TControl)
};
void __fastcall TMyControl::CMChangeColor(TMessage &Message)
{
Color = Message.LParam;
// set color from long parameter
TControl::CMChangeColor(Message);
// call the inherited message handler
}
 
接受答案了.
 
后退
顶部