我现在使用delphi 做出dll了,使用delphi 能够正确调用,但是使用vb怎么样调用呢
delphi中的dll 的函数
function DecodeBase64(Source:ShortString):ShortString; stdcall;
function EncodeBase64(Source:ShortString):ShortString;stdcall;
在delphi 的调用方法
function DecodeBase64(Source:ShortString):ShortString; stdcall;external 'Project2.dll';
function EncodeBase64(Source:ShortString):ShortString;stdcall;
external 'Project2.dll';怎样将 这段delphi 更改成vb调用的呢
delphi中的dll 的函数
function DecodeBase64(Source:ShortString):ShortString; stdcall;
function EncodeBase64(Source:ShortString):ShortString;stdcall;
在delphi 的调用方法
function DecodeBase64(Source:ShortString):ShortString; stdcall;external 'Project2.dll';
function EncodeBase64(Source:ShortString):ShortString;stdcall;
external 'Project2.dll';怎样将 这段delphi 更改成vb调用的呢
function DecodeBase64(Source:ShortString):ShortString; stdcall;
--------------------------
Declare Function DecodeBase64 Lib "'Project2.dll'" Alias "DecodeBase64 " (Byval Source As String) As Stringfunction EncodeBase64(Source:ShortString):ShortString;stdcall;
--------------------------
Declare Function EncodeBase64Lib "'Project2.dll'" Alias "EncodeBase64" (Byval Source As String) As String
我就是这样调用的,就是使用的时候出个错误提示. 然后就关闭了.这个错误.我明天给你贴出来.
"0x0000000"指令引用的"0x0000000"内存,该内存不能为"read".
要终止程序,请单击"确定".
要调试程序,请单击"取消".
wLength: WORD;
szBuf: array of Char;
end;
--------------------Type ShortString
wLength As Integer
szBuf As String*255 '或者szBuf(0 to 254) As Byte ShortString 只支持255 个字符
End TypeDeclare Function DecodeBase64 Lib "'Project2.dll'" Alias "DecodeBase64 " (Byval Source As ShortString) As ShortString
wLength As Integer
szBuf As String * 255 '或者szBuf(0 to 254) As Byte ShortString 只支持255 个字符
End TypeDeclare Function EncodeBase64 Lib "Project2.dll" Alias "DecodeBase64 " (ByVal Source As ShortString) As ShortString
Declare Function DecodeBase64 Lib "Project2.dll" Alias "DecodeBase64 " (ByVal Source As ShortString) As ShortString
Private Sub Command1_Click()
Text2.Text = DecodeBase64(Text2.Text)
End SubPrivate Sub Command2_Click()
Text3.Text = DecodeBase64(Text2.Text)
End Sub
提示:compile error:
user-defined try may not be passed byval
[email protected]
Private Type ShortString
wLength As Integer
szBuf() As Byte
End TypePrivate Declare Function EncodeBase64 Lib "Project2.dll" Alias "DecodeBase64 " (Source As ShortString) As ShortString
Private Declare Function DecodeBase64 Lib "Project2.dll" Alias "DecodeBase64 " (Source As ShortString) As ShortStringPrivate Sub Command1_Click() Dim udtCode As ShortString
udtCode.szBuf = StrConv(Text2.Text, vbFromUnicode)
udtCode.wLength = UBound(udtCode.szBuf) + 1
Text2.Text=StrConv(EncodeBase64(udtCode).szBuf,vbUnicode)
End Sub
Private Sub Command1_Click() Dim udtCode As ShortString
udtCode.szBuf = StrConv(Text2.Text, vbFromUnicode)
udtCode.wLength = UBound(udtCode.szBuf) + 1
Text3.Text=StrConv(DecodeBase64(udtCode).szBuf,vbUnicode)
End Sub
和http://community.csdn.net/Expert/TopicView.asp?id=4777361
也都是我问的帖子
您已经成功将信发送到: [email protected]信我已经发了