惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

C
CXSECURITY Database RSS Feed - CXSecurity.com
Stack Overflow Blog
Stack Overflow Blog
月光博客
月光博客
T
Threat Research - Cisco Blogs
小众软件
小众软件
有赞技术团队
有赞技术团队
酷 壳 – CoolShell
酷 壳 – CoolShell
Apple Machine Learning Research
Apple Machine Learning Research
C
Cyber Attacks, Cyber Crime and Cyber Security
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
T
Tailwind CSS Blog
Cisco Talos Blog
Cisco Talos Blog
V
V2EX
博客园 - 【当耐特】
C
Cybersecurity and Infrastructure Security Agency CISA
Hugging Face - Blog
Hugging Face - Blog
The Cloudflare Blog
The Last Watchdog
The Last Watchdog
Simon Willison's Weblog
Simon Willison's Weblog
T
Threatpost
S
Secure Thoughts
O
OpenAI News
P
Proofpoint News Feed
S
SegmentFault 最新的问题
Forbes - Security
Forbes - Security
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Application and Cybersecurity Blog
Application and Cybersecurity Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Last Week in AI
Last Week in AI
宝玉的分享
宝玉的分享
Scott Helme
Scott Helme
T
Tenable Blog
A
Arctic Wolf
L
LINUX DO - 热门话题
爱范儿
爱范儿
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
www.infosecurity-magazine.com
www.infosecurity-magazine.com
V
Visual Studio Blog
Hacker News: Ask HN
Hacker News: Ask HN
Hacker News - Newest:
Hacker News - Newest: "LLM"
腾讯CDC
博客园 - Franky
WordPress大学
WordPress大学
Know Your Adversary
Know Your Adversary
博客园_首页
雷峰网
雷峰网
IT之家
IT之家
PCI Perspectives
PCI Perspectives
L
LINUX DO - 最新话题
H
Heimdal Security Blog

博客园 - Jonny Yu

[GCC学习]get the optimized function call graph 界面开发中的那些疯狂的小事 Re:架构设计之性能设计经验 技术资产管理 .Net下进程外COM服务器的实现 控件的鼠标拖动和改变大小实现的思考 Learn from mistake, i.e. 和 e.g. 是不同的 How can I hide a user from the Welcome Screen in Windows XP? About HDC about wParam and lParam 就差一点点-微妙的强制类型转换 [GDI+]DrawRectangle和FillRectangle,细节决定成败 Disable the CrossThreadChecking in .Net Framework v2.0 several useful Store Procedures in MSSQL http://cnblogs.com/rickie/archive/2005/07/02/184927.aspx VS2005使用体验 Inventor 的一些快捷键 First day in Hanna. XPath crash course note
window class, OO
Jonny Yu · 2005-08-23 · via 博客园 - Jonny Yu

Wndows中Window Management 的设计
是很符合OO思想。

首先每个Window的定义由WNDCLASS结构定义。在WNDCLASS中我们需要给出
Window class name, Window的class style, 以及Wndow Procedure,WNDCLASS还提供了申请
extra class bytes 和extra window byte的能力。这两个空间可以类比的理解为class static fields和
object fields。和一般的class定义一样,WNDCLASS结构定义了Window对象的状态和行为。
这样凡是同类的Window不论它的位置,大小以及窗口属性如何都可以使用同一个WNDCLASS.
而对于行为有所不同的Window我们亦可以通过Sub-classing的方式通过改变其中一些消息
的行为得到所需的效果,这个方式事实上等同于override virtual method了,当然还有super-classing的说法。
每一个WNDCLASS在使用之前必须先注册到Win32 User Module中,随后用户即可使用CreateWindow创建Window实例了,值得注意的是在CreateWindow是我们并不是获取该WNDCLASS结构的指针来说明所使用的WNDCLASS的,而是通过Window class name, 如果将这些API在C#里面重写一下就可以看到一个很熟悉的设计。
class WindowManager
{
     public static void RegisterWindowClass(WindowClass wc);
     public static IWindow CreateWindow(string windowClassName, CreateWindowParameters params);
     //...
}
没错,Factory method, 事实上我们也正是靠这个方式重用了Common Controls.
这里我将返回的HWND写成IWindow接口,因为我觉得hwnd对于一系列Window function就如同this指针对于成员方法一般。hwnd应该被认为是C函数中的this指针,而不是Window对象的私有数据成员,事实上Window对象的数据封装做的非常到位,没有暴露出一个内部数据结构。
思路断掉了,以后再写。。。