开发者

Equivalent of Win32's ________ in .NET

I recently needed to find the .NET equivalent to ShellExecute, and I was happily able to find the answer quickly at StackOverflow. But surely there must be document or a list somewhere which would have given me this answer just a little quicker.

Back when I went from ANSI programming to UNICODE, Microsoft had this handy page of routine mappings:

ht开发者_如何学Gotp://msdn.microsoft.com/en-us/library/Aa272889

I put some of it into a text file, and when I needed to know, say, the Unicode equivalent of strlen, I'd just grep the file for strlen and I'd get:

C:\> grep strlen textfuncs.txt

strlen    _tcsclen
strlen    _tsclen

Does anyone have, or know of, a list like that for Win32 -> .NET?


Part of the problem here is that Win32 doesn't migrate directly to .NET.

The .NET Framework handles most of the Win32 API functionality, but it does so in a very different manner. Instead of trying to just map functions, it maps functionality into framework types. Sometimes, this is a very straight mapping, but sometimes, many different APIs are mixed together, and parts are rewritten in managed code, etc.

Typically, a quick search for your "goal" instead of the function will turn up the proper API very quickly.


As the .net API is a full fledged object library. It would be hard to have a one to one mapping from win32 to .net. But in most cases a quick google search will be able to get you to the correct class.


Aren't you looking for something like this:

Microsoft Win32 to Microsoft .NET Framework API Map


Not exactly a 1-1 mapping but you can find most things related to using Win32 calls in .NET at: http://www.pinvoke.net.

Lots of Win32 functions, related documents and sample codes are there.


This site is excellent for .NET to Win32 interop:

PInvoke.net: the interop wiki

There are "Alternative Managed API" entries where available, but due to the fine grained nature of the Win32 API's there may not be an equivalent in the managed API. A single method in the managed API may require several calls to Win32 across multiple libraries to achieve a single task.

Asking for exact equivalents would be like asking what's the managed equivalent of an assembly language instruction when the managed language/API doesn't provide that level of granularity.


I just stumbled upon this page, which does a pretty good job of providing what I was looking for:

C# for MFC Programmers - Quick Equivalents Map

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜