VC雕虫小技集(二)[3]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 he_zhidan 的 blog

class cmainframe:public cmdiframewnd

{

...

// 一般消息映射函数

protected:

// {{afx_msg(cmainframe)

afx_msg int oncreate(lpcreatestruct lpcreatestruct);

afx_msg void ontimer(uint nidevent);

afx_msg lresult onmymessage(wparam wparam, lparam lparam);

//}}afx_msg

declare_message_map()

}

第四步:在用户类的消息块中,使用on_message宏指令将消息映射到消息处理函数中。

begin_message_map(cmainframe, cmdiframewnd)

//{{afx_msg_map(cmainframe)

on_wm_create()

on_wm_timer()

on_message(wm_my_message, onmymessage)

//}}afx_msg_map

end_message_map()

如果用户需要一个整个系统唯一的消息,可以调用sdk函数registerwindowmessage并使用on_register_message宏指令取代on_message宏指令,其余步骤同上。

 

7,wscanfscanf的宽字符版本,用法与scanf是一样的,用来读取stdin流,并将信息存储到其参数列表指定的变量中。

cin 对象是由istream类所衍生出的,主要用来将数据由标准输入装置输入到程序中的变量,通过cin输入的数据,必须以字节流的格式组成,cin搭配“>>”用算符

 

本文关键:VC 雕虫小技集
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top