VB.NET中的DLL调用 [英] DLL Call in VB.NET
问题描述
Hello NG,
我在VB6代码中遵循声明:
声明功能EPS48_Receive Lib" bkeps48.dll" (ByVal RecvData As String,
ByVal MaxLength As Integer)作为整数
这是我称之为函数的代码:
>
Dim Length as Integer
Dim RecvData as String * 1021
长度= EPS48_Receive(RecvData,1021)
这里我获得了RecvData的值。但是当我在VB.NET中使用它时:
声明函数EPS48_Receive Lib" bkeps48.dll" (ByVal RecvData As String,
ByVal MaxLength As Int16)As Int16
Dim RecvData As String
Dim长度为Int16
....我对RecvData一无所获 。
我的代码中有什么争议?
谢谢,
最高>
Hello NG,
I Have follow Declaration in my VB6 Code:
Declare Function EPS48_Receive Lib "bkeps48.dll" (ByVal RecvData As String,
ByVal MaxLength As Integer) As Integer
This is the Code where i call this Function:
Dim Length as Integer
Dim RecvData as String * 1021
Length = EPS48_Receive(RecvData, 1021)
Here I get a Value for RecvData. But when I use the same in VB.NET:
Declare Function EPS48_Receive Lib "bkeps48.dll" (ByVal RecvData As String,
ByVal MaxLength As Int16) As Int16
Dim RecvData As String
Dim Length As Int16
Length = bkeps48.EPS48_Receive(RecvData, 1021)
.... i get ''nothing'' for RecvData.
What is wrang in my Code?
Thanks,
Max
推荐答案
>我在VB6代码中遵循声明:
> I Have follow Declaration in my VB6 Code:
声明函数EPS48_Receive Lib" bkeps48.dll" (ByVal RecvData As
String,ByVal MaxLength As Integer)As Integer
声明函数EPS48_Receive Lib" bkeps48.dll" (ByVal RecvData As
String,ByVal MaxLength As Int16)As Int16
我的代码中有什么争议?
Declare Function EPS48_Receive Lib "bkeps48.dll" (ByVal RecvData As String, ByVal MaxLength As Integer) As Integer
Declare Function EPS48_Receive Lib "bkeps48.dll" (ByVal RecvData As String, ByVal MaxLength As Int16) As Int16
What is wrang in my Code?
你需要编组字符串(VB.NET不会像VB6那样为你做这件事
)......不幸的是我有一段时间没有这样做而且我没有任何代码
手边的例子让我无法帮助更多(语法有点神秘
第一次使用它时)。
其他人会跳到你的救援我很确定:)同时搜索mashaling
和谷歌上的字符串应该会出现有趣的链接
Alex。
You need to marshall the string (VB.NET doesn''t do it for you like VB6
did)...... Unfortunatly I didn''t do it in a while and I don''t have any code
example at hand so I can''t help more than this (the syntax is a bit cryptic
the first time you use it).
Others will jump to your rescue I''m sure :) Meanwhile a seach for mashaling
and strings on google should turn up interesting links
Alex.
" Maximilian Hofer" <毫安************** @ kriegsauer.at> schrieb
"Maximilian Hofer" <ma**************@kriegsauer.at> schrieb
声明函数EPS48_Receive Lib" bkeps48.dll" (ByVal RecvData As
String,ByVal MaxLength As Int16)As Int16
将RecvData作为字符串调暗
昏暗长度为Int16
长度= bkeps48.EPS48_Receive(RecvData,1021)
...我对RecvData没事。
我的代码中有什么争议?
Declare Function EPS48_Receive Lib "bkeps48.dll" (ByVal RecvData As
String, ByVal MaxLength As Int16) As Int16
Dim RecvData As String
Dim Length As Int16
Length = bkeps48.EPS48_Receive(RecvData, 1021)
... i get ''nothing'' for RecvData.
What is wrang in my Code?
<
http:/ /msdn.microsoft.com/library/en...ingstrings.asp
请参阅作为结果行。
-
Armin
如何报价及原因:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
http://msdn.microsoft.com/library/en...ingstrings.asp
See the "as Result" row.
--
Armin
How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
*" Sin" <峰; br **** @ hotmail.com> scripsit:
* "Sin" <br****@hotmail.com> scripsit:
声明函数EPS48_Receive Lib" bkeps48.dll" (ByVal RecvData As
Declare Function EPS48_Receive Lib "bkeps48.dll" (ByVal RecvData As
String,
String,
ByVal MaxLength As Integer)As Integer
声明函数EPS48_Receive Lib" bkeps48.dll" (ByVal RecvData As
ByVal MaxLength As Integer) As Integer
Declare Function EPS48_Receive Lib "bkeps48.dll" (ByVal RecvData As
String,
String,
ByVal MaxLength As Int16)As Int16
ByVal MaxLength As Int16) As Int16
你需要编组字符串(VB。 NET不会像VB6那样为你做这个
You need to marshall the string (VB.NET doesn''t do it for you like VB6
当使用VB.NET'''Declare''时,我认为这不应该使任何
的区别 - 即使是VB.NET也会为字符串进行编组。
-
Herfried K. Wagner [MVP]
< URL:http://dotnet.mvps.org/>
When using VB.NET''s ''Declare'', I thin this should not make any
difference -- even VB.NET will do marshalling for the string.
--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
这篇关于VB.NET中的DLL调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!