关于windows api的一个简单问题 [英] One simple question about windows api
问题描述
这意味着什么:
< system.runtime.interopservices.structlayout(0,CharSet:= 3>结构blabla
或:
< system.runtime.interopservices.structlayout(0)>结构blabla2
我的意思是为什么是尖锐的支架?
你也可以给我一些很好的深入教程(或书),它解释了windows api的用法vb.net(不是微软的)
谢谢!
PS:我需要使用windows api - 只是说在某人之前告诉我不要使用它:)
What tose that mean:
<system.runtime.interopservices.structlayout(0, "CharSet:=3"> Structure blabla
or :
<system.runtime.interopservices.structlayout(0)> Structure blabla2
I mean why is the sharp breckets?
Also can you point me some good in-depth tutorial(or book) that explains usage of windows api in vb.net (not the microsoft one)
Thank you!
PS: I need to use windows api - just to say before someone tell me not to use it :)
推荐答案
尖括号表示在您的情况下应用于结构定义的属性。它们可以应用于类和方法定义等其他内容。
StructLayout
属性描述.NET的方式CLR应该在内存中布局结构成员。但是,您显示的参数是数字(可怕的幻数),应该是实际的枚举值,例如:
The angle brackets denote an attribute applied to, in your case, a Structure definition. They can be applied to other things like Class and Method definitions.
TheStructLayout
attribute describes how the .NET CLR should layout the structure members in memory. Though, the parameters you've shown are numeric (terrible magic numbers) and should be the actual enum values, such as:
<StructLayout(LayoutKind.Sequential)>
Structure blablabla
您可以从本教程开始: http://msdn.microsoft.com/en-us/library/aa288454%28v=vs.71%29.aspx [ ^ ]。
参见:
http://msdn.microsoft.com/en-us/library/z0w1kczw.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/39967861%28v=vs.90%29.aspx [<一个href =http://msdn.microsoft.com/en-us/library/39967861%28v=vs.90%29.aspxtarget =_ blanktitle =New Window> ^ ],
http:// en。 wikipedia.org/wiki/Metadata_%28CLI%29 [ ^ ]。
这篇介绍性的CodeProject文章也很有用:在.NET应用程序中创建和使用属性 [ ^ ]。
-SA
You can start with this tutorial: http://msdn.microsoft.com/en-us/library/aa288454%28v=vs.71%29.aspx[^].
See also:
http://msdn.microsoft.com/en-us/library/z0w1kczw.aspx[^],
http://msdn.microsoft.com/en-us/library/39967861%28v=vs.90%29.aspx[^],
http://en.wikipedia.org/wiki/Metadata_%28CLI%29[^].
This introductory CodeProject article can also be useful: Creating and Using Attributes in your .NET application[^].
—SA
这篇关于关于windows api的一个简单问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!