.NET包装的Webkit [英] .NET wrapper for Webkit

查看:171
本文介绍了.NET包装的Webkit的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Visual Studio 2011年WebKit的.NET包装创造了一个浏览器。但是,由于我是新的C#我可能有一个奇怪的问题...

I've created an browser in Visual Studio 2011 with the WebKit .NET wrapper. But since I'm new to C# I maybe have a strange question...

为什么我就不能使用: http://www.webkit.org/ 了解我的浏览器?如果这是不可能的,如何努力会是创建一个.NET包装WebKit的?而如何...

Why can't I just use: http://www.webkit.org/ for my browser? And if that's impossible, how hard would it be to create an .NET wrapper for WebKit?? And how...

推荐答案

由于Webkit内核是用C ++编写,不是在C#。需要一个转换层的C#的管理code执行环境和非托管code WebKit中的元帅。这不是特别困难的Webkit内核,它支持COM自动化接口。该.NET支持好东西。

Because Webkit was written in C++, not in C#. A translation layer is needed to marshal between the managed code execution environment of C# and the unmanaged code in Webkit. That's not particularly difficult for Webkit, it supports a COM automation interface. Something that .NET supports well.

必要的出发点是类型库的Webkit。这是程序集元数据的COM版本,它描述了一种语言无关的方式非托管COM接口类型。在.NET Tlbimp.exe将工具转换类型库到.NET互操作库。轻松做在Visual Studio中,您使用Project +添加引用,浏览选项卡,选择Webkit.tlb文件。自动生成Webkit.Interop.dll组件,COM接口的.NET版本。

The necessary starting point is the type library for Webkit. That's the COM version of assembly metadata, it describes the unmanaged COM interface types in a language neutral manner. The .NET Tlbimp.exe tool translates the type library into a .NET interop library. Easy to do in Visual Studio, you use Project + Add Reference, Browse tab and select the Webkit.tlb file. That automatically generates the Webkit.Interop.dll assembly, the .NET version of the COM interface.

正如你可能会怀疑,这个接口是不是特别小。从那里,你可以编写隐藏接口的复杂性,采取这种 SourceForge项目粘性友好的.NET包装类。研究它,看看它是如何使用的接口应该有所启发。在.NET WebBrowser控件和的HTMLDocument和的HtmlElement类的工作方式不尽相同,但IE浏览器。

As you might suspect, that interface is not particularly small. From there, you could write friendly .NET wrapper classes that hide the interface complexity, the tack taken by this SourceForge project. Studying it to see how it uses the interface should be enlightening. The .NET WebBrowser control and HtmlDocument and HtmlElement classes work the exact same way, but for IE.

这篇关于.NET包装的Webkit的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆