超 的个人资料一只特立独行的老鼠照片日志列表 工具 帮助

日志


1月6日

GetYourXXDC()

 

CWnd::GetDC

CDC* GetDC( );

Return Value

Identifies the device context for the CWnd client area if successful; otherwise, the return value is NULL. The pointer may be temporary and should not be stored for later use.

Remarks

Retrieves a pointer to a common, class, or private device context for the client area depending on the class style specified for the CWnd. For common device contexts, GetDC assigns default attributes to the context each time it is retrieved. For class and private contexts, GetDC leaves the previously assigned attributes unchanged. The device context can be used in subsequent graphics device interface (GDI) functions to draw in the client area.

Unless the device context belongs to a window class, the ReleaseDC member function must be called to release the context after painting. Since only five common device contexts are available at any given time, failure to release a device context can prevent other applications from accessing a device context.

A device context belonging to the CWnd class is returned by the GetDC member function if CS_CLASSDC, CS_OWNDC, or CS_PARENTDC was specified as a style in the WNDCLASS structure when the class was registered.

CWnd OverviewClass MembersHierarchy Chart

See Also   CWnd::GetDCEx, CWnd::ReleaseDC, CWnd::GetWindowDC, ::GetDC, CClientDC

---------------------------------------------------------------------------------------------------------

释放资源有多难?

GetDC的倒霉名字让人误以为她会优雅的传回一个指针,一夜柔情后轻轻的她走了不占用任何资源,不需负任何责任。实际上不但独占了特定设备的Context,而且无明白的要兴建一个新的对象。所以所有忘了ReleaseDC的同志只能安心等待5分钟后系统不堪重负整个瘫痪,十个月后瓜熟落地,人命官司。为保证下次不犯同样错误,在编程环境上加上一个template,仿照“奥你XX运”的格式加入一个GetYourXXDC()方法,自己封装成对的GetDC和ReleaseDC。同理可以构建NewYourXXObject以将new和delete对应封装,整个世界清静了。

 

1月5日

2007

2007年 奥运进入倒数,
人民日报称百姓生活继续幸福。
 
一颗嫦娥上了天,万千矿工入了土;
半夜提税拦不住,全民疯狂炒股;
肉价从8块涨到十五,它不是一头猪;
不要给房奴任何机会,不能让所有人都有房住;
 
深圳点火把外地民工房烧成焦土;
京城私家车不要给外国友人添堵;
重庆感谢三峡让大家感受夏日42度;
杭州县长脱光衣服还在车里谈公务;
 
山西砖窑济南银座辽宁钢水包,外交部说我们的人权等于美国*5;
太湖蓝藻洞庭老鼠北京沙尘暴,厦门人民为了PX组织上街大散步;
纸箱肉包“严打中国”鸭蛋苏丹红,吴仪说我们的食品基本没有毒;
嘲讽布什力挺缅甸冷眼伊拉克,小水说美国无权公审处死萨达姆;
 
胡总说人民要有知情权,
所以十7大成了敏感词上不了google百度;
牛博YouTube都成了404错误;
环球时报怎么听怎么像杨二车娜姆;
 
姚明继续首轮就被屠,小易其实不想去雄鹿;
对中国男足来说每次抽签都是死亡组;
易中天讲三国王立群讲史记纪连海讲和绅,
于丹说只要心态好被强奸也可以觉得很满足;
 
李阳可以让学生下跪让弟子剃秃;
孔庆东时时面朝大海向金二祝福;
老罗和方舟子终于开始公然掐架;
神棍丁小平率弟子大闹一席一虎;
 
中医,儒教,龙图腾,中国式民主,
北京六月雪,南京徐老太,陕西华南虎...
神奇的土地上的神奇的故事,
相信人民,相信政府。