
正文
c调用vb.net c调用dll
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
请教:我现在手里有原来别人写的.vb代码(vb.net写的),现在我想在C中调用这段代码编译生成dll?
先把vb.netc调用vb.net的编译成dllc调用vb.net,就可以在c中和java中直接掉
相关问答
Q1: vs2005中 c++怎样调用vb.net生成的dll
1、先引用你c调用vb.net的dll(不要说你不知道怎么引用)
2、using你dllc调用vb.net的命名空间
3、在代码中声明dll中的类(如c调用vb.net:Lyric * l = new Lyric();)
4、接着开始编程
假如你的dll中的Lyric类有GetLyric(FileName)的方法c调用vb.net,就直接写上去就可以了(如:String * s = l.GetLyric("C:\\1.lrc");)
如果你是要在C++中编辑这个已经生成的DLL,那是不可能的
我不是很会c++,有无法错误自己改
Q2: 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
Q3: 一个C++的DLL在vb.net或C#中调用问题
建议用CLRInsideOut这个软件自动声明。这是我用它翻译成vb.net声明的结果:
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和c调用dll的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。







