Api功能 [英] Api functions

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

问题描述

您好,我想问一下什么是API函数,它们与

常规函数有什么不同?如何在C#/ visual C#中使用它们。 (如果可以的话,请给出一个

的例子)

非常感谢。

Hello, I wanted to ask what are API functions, how do they differ from the
regular functions and how can I use them in C#/visual C#. ( please give an
example if you can)
Thanks a lot.

推荐答案

Michael,


API是一个通用术语,可以通过多种不同的方式使用。

例如,框架本身可以被视为API。但是,当一个人说Windows API时,大部分时间都是b $ b。 (这就是我使用这个术语的方式),它是
表示由系统OS dll(kernel32,user32,

advapi等等)导出的函数。 />

希望这会有所帮助。

-

- Nicholas Paldino [.NET / C#MVP]

- mv*@spam.guard.caspershouse.com

" Michael" <弥***** @ discussions.microsoft.com>在消息中写道

news:50 ********************************** @ microsof t.com ...
Michael,

API is a general term that can be used in a number of different ways.
For example, the framework itself can be considered an API. However, most
of the time, when one says "Windows API" (which is how I use the term), it
means the functions exported by the system OS dlls (kernel32, user32,
advapi, etc, etc).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Michael" <Mi*****@discussions.microsoft.com> wrote in message
news:50**********************************@microsof t.com...
您好,我想问一下什么是API函数,它们与常规函数有什么不同?如何在C#/ visual C#中使用它们。 (如果可以,请给出一个
示例)
非常感谢。
Hello, I wanted to ask what are API functions, how do they differ from the
regular functions and how can I use them in C#/visual C#. ( please give an
example if you can)
Thanks a lot.



除了尼古拉斯已经说过的话,你正在研究如何从c#中使用它们,b / b
见: http://pinvoke.net/

" Michael" <弥***** @ discussions.microsoft.com>在消息中写道

news:50 ********************************** @ microsof t.com ...
In addition to what Nicholas has already said, if you''re looking at how to
use them from c#,
see: http://pinvoke.net/

"Michael" <Mi*****@discussions.microsoft.com> wrote in message
news:50**********************************@microsof t.com...
您好,我想问一下什么是API函数,它们与常规函数有什么不同?如何在C#/ visual C#中使用它们。 (如果可以的话,请给出一个
示例)
非常感谢。
Hello, I wanted to ask what are API functions, how do they differ from the
regular functions and how can I use them in C#/visual C#. ( please give an
example if you can)
Thanks a lot.



谢谢。

但是我使用的函数我得到编译时错误:

无效的表达式术语''[''

;预期

无效的表达式temr'']''

我看到[DllImport(" kernel32.dll")]下的红色下划线

例如当我尝试使用api函数CreateDirectory时。

缺少什么?

PS:我已经包含了使用System这一行。 Runtime.InteropServices;"如果那个

帮助

PS2:api函数的结构是:

[DllImport(" kernel32.dll")]

static extern bool CreateDirectory(string lpPathName,

IntPtr lpSecurityAttributes);


" Philip Rieck"写道:
Thanks.
But very function I use I get the compile time error:
Invalid expression term ''[''
; expected
Invalid expression temr '']''
and I see a red underline under the "[DllImport("kernel32.dll")]
for example when I try to use the api function CreateDirectory.
What''s missing?
PS: I have included the line "using System.Runtime.InteropServices;" if that
helps
PS2:the structure of the api function is:
[DllImport("kernel32.dll")]
static extern bool CreateDirectory(string lpPathName,
IntPtr lpSecurityAttributes);

"Philip Rieck" wrote:
除了尼古拉斯已经说过的话,如果你正在研究如何从c#中使用它们,请看: http://pinvoke.net/

迈克尔 <弥***** @ discussions.microsoft.com>在消息中写道
新闻:50 ********************************** @ microsof t.com。 ..
In addition to what Nicholas has already said, if you''re looking at how to
use them from c#,
see: http://pinvoke.net/

"Michael" <Mi*****@discussions.microsoft.com> wrote in message
news:50**********************************@microsof t.com...
您好,我想问一下什么是API函数,它们与常规函数有什么不同,以及如何在C#/ visual C#中使用它们。 (如果可以的话,请给出一个
示例)
非常感谢。
Hello, I wanted to ask what are API functions, how do they differ from the
regular functions and how can I use them in C#/visual C#. ( please give an
example if you can)
Thanks a lot.




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

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