|
|
|
|
|
[求助]钻一下牛角。没有消息循环依然能处理消息
消息循环的概念,一般是指GetMessage();DispatchMessage()的循环。 实际上,大部的系统消息是直接发送到窗口过程的,而不放入消息队列的。 你可以做这样一上试验,窗口过程什么都不做,只是每调用一次,就将一个全局计数变量增1,然后将消息直接交给DefWndProc(). 主函数里CreateWindow()后,ShowWindow(),UpdateWindow(),然后检测一下这个计数值,你会发现窗口过程已经被调用的次数远远超出你的想象。 或者更进一步,窗口函数将收到的消息记录下来,可以看看在CreateWindow的过程中都会收到哪些消息。 再进一步,你在主函数里调用比如MoveWindow()或InvalidateRect()之类的函数,你会发现不用你DispatchMessage(),消息是直接被发送到窗口过程的。 这也是为什么Windows的窗口必须有一个回调函数 ,而且采取先GetMessage()再DispatchMessage()这样“笨重”方法,如果你看过X Window的书,可以知道X Window的编程模型是(用Windows的API来类比,实际X的概念不叫Message,而叫Event)只有Get,没有Dispatch的,因为它没有采用回调机制,而是由程序自行对收到的事件进行判断。 |
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值