• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • JavaScript
  • ASP.NET
  • PHP
  • 正则表达式
  • AJAX
  • JSP
  • ASP
  • Flex
  • XML
  • 编程技巧
  • Android
  • swift
  • C#教程
  • vb
  • vb.net
  • C语言
  • Java
  • Delphi
  • 易语言
  • vc/mfc
  • 嵌入式开发
  • 游戏开发
  • ios
  • 编程问答
  • 汇编语言
  • 微信小程序
  • 数据结构
  • OpenGL
  • 架构设计
  • qt
  • 微信公众号
您的位置:首页 > 程序设计 >vc/mfc > 微软的bug,但他们的客户支持说不容易fix,给了替代办法,但我不知道怎么用这些GDIAPI

微软的bug,但他们的客户支持说不容易fix,给了替代办法,但我不知道怎么用这些GDIAPI

作者:佚名 字体:[增加 减小] 来源:互联网 时间:2017-06-04

佚名通过本文主要向大家介绍了微软的bug,但他们的客户支持说不容易fix,给了替代办法,但我不知道怎么用这些GDIAPI等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
问题: 微软的bug,但他们的客户支持说不容易fix,给了替代办法,但我不知道怎么用这些GDI API
描述:

GetTextExtent在某些非英文系统下会有内存泄漏。
for( lineNumber = 0; lineNumber<lines; lineNumber++) 
{   
    ......     
    CSize WrittenSize = cDC.GetTextExtent( OneLine ); 
    cDC.TextOut( x- WrittenSize.cx/2, y, OneLine ); 
    y += WrittenSize.cy; 
    .     ........... 
} 
实际上我们写了一个简单的测试程序,就是在OnDraw()里头调用这个函数,放大和缩小窗口(每刷新一次),也就是执行一次GetTextExtent,内存都会有增长。
-----------------------微软的建议-------------------------------------------
(中文意思:用ExtTextOut输出,以图片的形式输出字符,用GetGlyphOutline、ExtTextOut这些函数来做。)但我没用过这些api,看msdn试着去做,一直没弄出来,那位能给个详细的例子,就是用ExtTextOut如何从字符到图片输出
Hi **,  
The current target is for Longhorn, but we could request an earlier hotfix if you wish.  If so, we would need a business impact statement from you, to log with the request.  Note that a hotfix request is just that  a request  and there is no guarantee that a fix will occur.  
Due to the uncertain nature of this, I would very strongly recommend investigating the workarounds I described previously.  Another (3rd) possible workaround to try would be to get the glyph images of the characters you want to draw (with GetGlyphOutline), then draw them with ExtTextOut and the ETO_GLYPH_INDICES flag.  I will experiment with this possibility tomorrow as well.  I do not know whether the memory leak will still occur when doing this. 
Please let me know how you would like to proceed.
+++++++++++++++++++++++++++++++++++++++
(中文意思:有两种替代方法,一是用bmp图片代替文本输出,这样放缩窗口就是放缩图片,但是文字可读性不好。第二种方法就是放缩窗口时,定义不同大小的字体,这样不用调用GetTextExtent,但这样放缩的比例会不精确)
Thanks **.  I have done some more research and testing.  Unfortunately, until this is fixed, I dont see a good workaround beyond the two that I described below. 
As mentioned, the only possibilities would be to render the text a single time to a bitmap, then scale the bitmap (using the bitmap dimensions to determine the size of the string).  Of course, the readability of the text will not be good and font scaling will not be smooth, but doing this will not leak.  Or, to generate different fonts with different sizes, to be used without scaling. 
Im sorry I don't have a better solution at this time.
+++++++++++++++++++++++++++++++++++++++
他们的email签名挺有意思
**** *******
Microsoft Developer Support
425-704-5212
****@microsoft.com
 
We want you to be "very satisfied" with Microsoft Support. If you cannot say you are "very satisfied", or if you'd like to make a comment (good or bad) about the quality of our support, please feel free to contact me (*****@microsoft.com) or my manager **** ******* (********@microsoft.com). 
 
Get Secure.  Visit http://windowsupdate.microsoft.com to update your machine with all critical security fixes and additional software updates.
---------------------------------------------------------------------------


解决方案1:

to xiaoyuzi (小鱼子) 
请问:你描述这个问题在那些操作系统上出现?

解决方案2:

mark

解决方案3:

ExtTextOut()
 参数表 
参数 类型及说明 
hdc Long,设备场景的句柄 
x,y Long,以逻辑坐标表示的一个点,指定了绘图起点 
wOptions Long,下述标志常数的任意组合 
ETO_CLIPPED 将文本剪切出指定的矩形 
ETO_GLPYH_INDEX lpString是一个字样索引表。参考对GetCharacterPlacement函数的说明。只适用于Win95 
ETO_OPAQUE 在正式描绘文本前,用当前的背景色填充矩形 
lpRect Rect,指定一个矩形,用于对文本进行格式化处理。可指定长整数0,在不用矩形区域的前提下描绘文本 
lpString String,欲描绘的字串 
nCount Long,字串中要显示出来的字符数 
lpDx Long,如果不是零,这个参数就代表指向一个Long值数组的指针。该数组对每一对字符的间距进行了说明(采用逻辑单位)。其中第一个条目是第一和第二个字符的间距;第二个条目是第二和第三个字符的间距;以此类推。如果为零,函数就使用字体的默认间距设置 


分享到:QQ空间新浪微博腾讯微博微信百度贴吧QQ好友复制网址打印

您可能想查找下面的文章:

  • 微软的bug,但他们的客户支持说不容易fix,给了替代办法,但我不知道怎么用这些GDIAPI

相关文章

  • 2017-06-05 谁做过,将调用DLL的代码简化一下,总是感觉调用DLL的代码动态载入很烦琐
  • 2017-06-04 向DLL中的函数传入CString参数的问题!
  • 2017-06-04 安装插件在IE上时,如何取得IE地址栏中的URL?
  • 2017-06-05 Windows2000专业版下无法拦截CreateProcess函数使用替换IAT的方法,但是2000Server和Xp下却可以,为什么?
  • 2017-06-04 ATL加载FLASH,ShockwaveFlashObjects出错!!
  • 2017-06-05 关于多线程的问题
  • 2017-06-04 direct2D画出来的图形为什么会发虚
  • 2017-06-04 怎样在vc的activex控件中实现扫描预览
  • 2017-06-05 COM组件能不能像ActiveX控件那样作为浏览器插件?
  • 2017-06-04 两种方法是用COM组件

文章分类

  • JavaScript
  • ASP.NET
  • PHP
  • 正则表达式
  • AJAX
  • JSP
  • ASP
  • Flex
  • XML
  • 编程技巧
  • Android
  • swift
  • C#教程
  • vb
  • vb.net
  • C语言
  • Java
  • Delphi
  • 易语言
  • vc/mfc
  • 嵌入式开发
  • 游戏开发
  • ios
  • 编程问答
  • 汇编语言
  • 微信小程序
  • 数据结构
  • OpenGL
  • 架构设计
  • qt
  • 微信公众号

最近更新的内容

    • 怎么在IE上添加一个工具条?
    • 把CView封装到ActiveX
    • VC做ATL组件的时候,只能有一个实现类么?
    • 关于VC读写EXCEL的问题
    • 如何把成员函数作为子线程的处理函数?(空)
    • 有哪位大虾能帮帮我解决下这个问题呀,不甚感激~~~:使用COM+产生的RPC服务器不可用(刚一开始好用,但用时间长了会出现)
    • 从线程外部结束线程
    • 传递一段数据流或内存块应如何定义组件接口?
    • 在win98下如何获得所有进程的列表???
    • 看看这个问题http://expertcsdnnet/Expert/topic/3040/3040912xml?temp=0295679

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有