未处理COMException(转载) 未处理webexception

在前一篇文章中介绍了C#透明按钮的实现,但是实验室其他人反应会出现未处理COMException,晚上把自己手头上任务完成之后,就想看看到底怎么回事,参考网上一篇文章的介绍,修改了一下源文件,测试了一下到现在为止没发现什么问题,但具体情况还有待检验,修改方法如下:

参考:http://www.codeplex.com/alphamobilecontrols/WorkItem/View.aspx?WorkItemId=3720

InIImagingFactory.cs, replace:
// We need the MarshalAs attribute here to keep COM interop fromsending the buffer down as
uintCreateImageFromBuffer([MarshalAs(UnmanagedType.LPArray)]byte[] buffer, uint size, BufferDisposalFlag disposalFlag, outIImage image);

With:
uint CreateImageFromBuffer(IntPtr buffer, uint size,BufferDisposalFlag disposalFlag, out IImageimage);

InAlphaImage.cs add this in the top of the file:
using System.Runtime.InteropServices;
And replace:
factory.CreateImageFromBuffer(pbBuf, cbBuf,BufferDisposalFlag.BufferDisposalFlagNone, outalphaImage._image);


With:
// Copy stream data into an unmanaged global buffer that will befreed by the factory once
// note that we cannot pass pbBuf directly since it might be movedaround or freed by the
IntPtr p =Marshal.AllocHGlobal((int)cbBuf);
Marshal.Copy(pbBuf, 0, p, (int)cbBuf);
factory.CreateImageFromBuffer(p, cbBuf,BufferDisposalFlag.BufferDisposalFlagGlobalFree, outalphaImage._image);

  

爱华网本文地址 » http://www.aihuau.com/a/25101017/364665.html

更多阅读

转载 未授将军衔的正兵团职以上将领名录:

原文地址:未授将军衔的正兵团职以上将领名录:作者:乌龙冰茶中国人民解放军无将军衔正兵团职以上将军名录:1、总参谋部:部顾问孔原(正大军区职)、 三部部长戴镜元、 通信部部长崔伦(正兵团职)、 通信部政委张凯、(正兵团职) 副总参谋长阎仲川(正

转载 第十四篇:SketchUpSU 怎么处理材质贴图的无缝拼接

原文地址:第十四篇:SketchUp(SU)怎么处理材质贴图的无缝拼接作者:SketchupPro自学 图1(在弧面上帐号材质可以看见有明显的破面)大家知道,在SU里面一个曲面其实由多个面组合而成的(把隐藏几何图形勾选上就可以知道),所以这种面在用颜料桶(B)进行填

声明:《未处理COMException(转载) 未处理webexception》为网友灰常二分享!如侵犯到您的合法权益请联系我们删除