English 中文(简体)
用于.Net的Windows API包装?
原标题:Windows API Wrapper for .Net?

Windows API


所以我知道WinForms稍微涉及了Windows API,但坦率地说,它很可怕。尤其是分层窗口和闪烁。所以我想知道是否有人为Windows API编写了部分或完整的包装器。我对分层窗口方面特别感兴趣,但实际上API的任何部分都是一个很好的起点。

更新:我在此处找到了Windows API代码包:http://code.msdn.microsoft.com/WindowsAPICodePack但它似乎没有包装分层Windows?我的假设正确吗?

Native API (Windows)


我听说了一些关于本机API的信息,但我不太确定它是为了什么?它提供了哪些功能?调查一下是个好主意吗?

Summary (Questions in a nutshell)


  1. Does anyone know of an existing (partial or full) wrapper of the Windows API?
    • If the answer is no to question one, where would be a good resource to learn about it myself, and potentially write my own?
  2. An explanation of the Native API? What does it do? Can I use it to make applications better? Can I even USE it at all?

我们非常感谢您对其中任何一个的回答:)谢谢

最佳回答

The LayeredWindows actually work better in WinForms than windows. The native windows controls don t even have the alpha channel support of the WinForms analogues, so native windows flicker, and require massive amounts of subclassing to override the painting to use alpha compatible routines.

你最好去WPF。windows团队根本没有很好地处理本机控件,甚至在启用aero-glass的情况下删除了对样式(WS_EX_COMPOSITED)的支持,考虑到windows控件的绘制方式,如果任何应用程序使用子窗口作为控件,那么它就不可能无闪烁地绘制。

WPF“绘制”窗口控件,但不使用离散(本机)子窗口来表示单个控件。这使它能够控制何时以及如何渲染其窗口曲面。

问题回答

您可以从PInvoke.NET

Windows API非常庞大。里面有很多东西。Windows窗体是它的一部分的包装器。WPF是它的部分的包装物。基类库的一部分(如System.IO.*)是它的一些部分的包装机。代码包是一个包装器,专门包装Vista和Windows 7中的新东西,而不是Windows窗体或WPF中的新事物。

你调查过WPF吗?结合特定API函数的P/Invoke,您可能需要很长一段路才能到达目的地。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...