OVH Cloud OVH Cloud

UTILISATION D'UNE API

2 réponses
Avatar
Laurent Jordi \(www.ezlogic.mc\)
Salut,

Je suis en train de finaliser une appli qui enverra des SMS de confirmation.
Mon fournisseur de SMS me donne une API que j'ai déja implémentée dans
access et qui marche très bien.

Je dois l'installer et l'utiliser à partir de mon serveur WEB.

Me conseilleriez-vous de développer la page qui va bien en ASP ou en
ASP.NET, j'hésite. Je ne sais pas comment on déclare une API en dot NET...

Merci à vous

LJ

2 réponses

Avatar
YJLAMOTTE
Voila : En utilisant un ptit INVOKE des familles..

Using Platform Invoke
Another way .NET can interact with unmanaged code is via functional calls to
unmanaged libraries such as the Windows API. This is achieved via platform
invoke.

The Declare statement tells the CLR where to find an API function by
specifying the name of the library and the name of the function. Once the
function has been declared in this way it can be used just like any other
function in .NET. An example:

<%@ Page Language="VB" %>
<%@ Import Namespace="System.Text" %>
<script runat="server">

Declare Auto Function GetComputerName Lib "kernel32" (ByVal lpBuffer as
string, ByRef nSize as integer) as integer

Sub Page_Load()
Dim strBuf as String = New String(CChar(" "), 128)
Dim intLen as integer = strBuf.length
Dim intRet as integer = GetComputerName(strBuf, intLen)
lblComputerName.text= "This computer is named " &
strBuf.ToString.Substring(0,intLen)
End Sub
</script>
<html>
<head>
</head>
<body>
<asp:Label id="lblComputerName" runat="server"/>
</body>
</html>

The web form will display the name of the computer where the code is run.
The Declare statement tells the CLR where to find an API function by
specifying the name of the library (here kernel32) and the name of the
function (here GetComputerName). Once declared your code can use the
function. The Auto modifier instructs the .NET Framework to use the
appropriate version of the API call for the platform where the code is
running, either the ANSI or Unicode versions.


source : http://www.dotnetjohn.com/articles/articleid74.aspx

YJLAMOTTE

"Laurent Jordi (www.ezlogic.mc)" a écrit :

Salut,

Je suis en train de finaliser une appli qui enverra des SMS de confirmation.
Mon fournisseur de SMS me donne une API que j'ai déja implémentée dans
access et qui marche très bien.

Je dois l'installer et l'utiliser à partir de mon serveur WEB.

Me conseilleriez-vous de développer la page qui va bien en ASP ou en
ASP.NET, j'hésite. Je ne sais pas comment on déclare une API en dot NET...

Merci à vous

LJ





Avatar
Laurent Jordi \(www.ezlogic.mc\)
YO !!


"YJLAMOTTE" a écrit dans le message de
news:
Voila : En utilisant un ptit INVOKE des familles..

Using Platform Invoke
Another way .NET can interact with unmanaged code is via functional calls


to
unmanaged libraries such as the Windows API. This is achieved via platform
invoke.

The Declare statement tells the CLR where to find an API function by
specifying the name of the library and the name of the function. Once the
function has been declared in this way it can be used just like any other
function in .NET. An example:

<%@ Page Language="VB" %>
<%@ Import Namespace="System.Text" %>
<script runat="server">

Declare Auto Function GetComputerName Lib "kernel32" (ByVal lpBuffer


as
string, ByRef nSize as integer) as integer

Sub Page_Load()
Dim strBuf as String = New String(CChar(" "), 128)
Dim intLen as integer = strBuf.length
Dim intRet as integer = GetComputerName(strBuf, intLen)
lblComputerName.text= "This computer is named " &
strBuf.ToString.Substring(0,intLen)
End Sub
</script>
<html>
<head>
</head>
<body>
<asp:Label id="lblComputerName" runat="server"/>
</body>
</html>

The web form will display the name of the computer where the code is run.
The Declare statement tells the CLR where to find an API function by
specifying the name of the library (here kernel32) and the name of the
function (here GetComputerName). Once declared your code can use the
function. The Auto modifier instructs the .NET Framework to use the
appropriate version of the API call for the platform where the code is
running, either the ANSI or Unicode versions.


source : http://www.dotnetjohn.com/articles/articleid74.aspx

YJLAMOTTE

"Laurent Jordi (www.ezlogic.mc)" a écrit :

> Salut,
>
> Je suis en train de finaliser une appli qui enverra des SMS de


confirmation.
> Mon fournisseur de SMS me donne une API que j'ai déja implémentée dans
> access et qui marche très bien.
>
> Je dois l'installer et l'utiliser à partir de mon serveur WEB.
>
> Me conseilleriez-vous de développer la page qui va bien en ASP ou en
> ASP.NET, j'hésite. Je ne sais pas comment on déclare une API en dot


NET...
>
> Merci à vous
>
> LJ
>
>
>