成都创新互联网站制作重庆分公司

c调用vb.net C调用restful

一个C++的DLL在vb.net或C#中调用问题

建议用CLRInsideOut这个软件自动声明。这是我用它翻译成vb.net声明的结果:

成都创新互联公司是一家专注于网站设计制作、成都网站设计与策划设计,东乡族网站建设哪家好?成都创新互联公司做网站,专注于网站建设十载,网设计领域的专业建站公司;建站业务涵盖:东乡族等地区。东乡族做网站价格咨询:028-86922220

System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)  _

Public Structure tagRECT

'''LONG-int

Public left As Integer

'''LONG-int

Public top As Integer

'''LONG-int

Public right As Integer

'''LONG-int

Public bottom As Integer

End Structure

System.Runtime.InteropServices.DllImportAttribute("Unknown", EntryPoint:="dMain")  _

Public Shared Sub dMain(ByVal pImage As System.IntPtr, ByRef rcRoi As tagRECT, ByVal w As Integer, ByVal h As Integer, ByVal PlateCharacters As System.IntPtr, ByRef rectPlateLocation As tagRECT, ByRef PlateReliability As Integer, ByVal nMod As Integer)

End Sub

把里面的Unknown换成你用的dll名称

C语言转换为VB.NET

Option Explicit On

Option Strict On

Imports System

Module Program

Sub Main()

Dim y,m,t As Integer

begin:

' 输入数据时一行一个

y=CInt(Console.ReadLine())

m=CInt(Console.ReadLine())

t=CInt(Console.ReadLine())

If y

200 Then

Console.WriteLine("ERROR")

goto begin

End If

pr(y,m,t)

Console.Write("Press any key to continue . . . ")

Console.ReadKey(True)

End Sub

Function pr(y As Integer,m As Integer,t As Integer) As Integer

Dim ye,[Me],i As Integer

ye=CInt((m+t-2)/12+y)

[Me]=(m+t-2) Mod 12+1

End If

End Function

Function mday(y As Integer,m As Integer) As Integer

Dim day As Integer()={0,31,28,31,30,31,30,31,31,30,31,30,31}

Dim ad As I

vs2005中 c++怎样调用vb.net生成的dll

1、先引用你的dll(不要说你不知道怎么引用)

2、using你dll的命名空间

3、在代码中声明dll中的类(如:Lyric * l = new Lyric();)

4、接着开始编程

假如你的dll中的Lyric类有GetLyric(FileName)的方法,就直接写上去就可以了(如:String * s = l.GetLyric("C:\\1.lrc");)

如果你是要在C++中编辑这个已经生成的DLL,那是不可能的

我不是很会c++,有无法错误自己改

请帮忙将以下C语言代码转换为VB.NET代码,谢谢!

Option Explicit On

Option Strict On

Imports System

Module Program

Sub Main()

Dim y,m,t As Integer

begin:

' 输入数据时一行一个

y=CInt(Console.ReadLine())

m=CInt(Console.ReadLine())

t=CInt(Console.ReadLine())

If y100 Then

y=y+2000

End If

If y1916 OrElse m200 Then

Console.WriteLine("ERROR")

goto begin

End If

pr(y,m,t)

Console.Write("Press any key to continue . . . ")

Console.ReadKey(True)

End Sub

Function pr(y As Integer,m As Integer,t As Integer) As Integer

Dim ye,[Me],i As Integer

ye=CInt((m+t-2)/12+y)

[Me]=(m+t-2) Mod 12+1

Console.WriteLine(" {0}-{1} ~ {2}-{3}",y,m,ye,[Me])

ye=y

[Me]=m

For i=0 To t-1

prmonth(ye,[me])

[Me]=[Me]+1

If [Me]12 Then

ye=ye+1

[me]=1

End If

Next

Return 0

End Function

Function yam(y As Integer,m As Integer) As Integer

Dim st As String()={"未定义","一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"}

Console.WriteLine(" {0} {1}",y,st(m))

Console.WriteLine("----------------------------")

Return 0

End Function

Function ryear(y As Integer) As Integer

If 0=y Mod 400 OrElse (0y Mod 100 AndAlso 0=y Mod 4) Then

Return 1

Else

Return 0

End If

End Function

Function mday(y As Integer,m As Integer) As Integer

Dim day As Integer()={0,31,28,31,30,31,30,31,31,30,31,30,31}

Dim ad As Integer=0

If 2=m Then

ad=ryear(y)

End If

Return day(m)+ad

End Function

Function monday(y As Integer,m As Integer) As Integer

Dim md As Integer=6

Dim i,daynum As Integer

For i=1916 To y-1

daynum=365+ryear(i)

md=(md+daynum) Mod 7

Next

For i=1 To m-1

md=(md+mday(y,i)) Mod 7

Next

Return md

End Function

Function prmonth(y As Integer,m As Integer) As Integer

Dim md As Integer=monday(y,m)

Dim daysnum As Integer=mday(y,m)

Dim days As Integer=daysnum+md

Dim i As Integer

yam(y,m)

Console.Write(" 日 一 二 三 四 五 六")

For i=0 To days-1

If 0=i Mod 7 Then

Console.WriteLine()

Console.WriteLine()

Console.Write(" ")

End If

If i-md=0 Then

Console.Write(" {0,2}",i-md+1)

Else

Console.Write(" ")

End If

Next

Console.WriteLine()

Console.WriteLine()

Return 0

End Function

End Module

vb.net 调用C语言可执行程序并传值?

在c语言中每一个变量都有两个属性一个是值,一个是址。比如inta=2;变量a的值是2,变量a的地址,可以用取地址

操作符

获取,即a。因此以C语言的函数传递中具备两种方式传递参数,一种是传址,一种传值。比如voidf1(intv){;}//函数f1v


网站标题:c调用vb.net C调用restful
新闻来源:http://cxhlcq.com/article/hjhged.html

其他资讯

在线咨询

微信咨询

电话咨询

028-86922220(工作日)

18980820575(7×24)

提交需求

返回顶部