type youfunc = function GetAttachFile(con, TableName, ID ,imageLB_path):boolean;stdcall; 是这样的吗? 是不是应该 type youfunc = function GetAttachFile(con, TableName, ID ,imageLB_path):boolean;stdcall;
type youfunc = function GetAttachFile(con, TableName, ID ,imageLB_path):boolean;stdcall; 是这样的吗? 是不是应该 type youfunc = function(con, TableName, ID ,imageLB_path):boolean;
@pfunc 还是为nil 这个是vb源程序Public Function GetAttachFile(ConnectionStr As String, TableSource As String, RecID As String, AttachDir As String) As String Dim Con As New ADODB.Connection Dim Rec As New ADODB.Recordset Dim PAttachDir As String Dim FileNameSize As Integer Dim FileSize As Long Dim FileName As String Dim ExSize As Long, AcSize As Long Dim Buffer() As Byte Dim TableName As String
Con.Open ConnectionStr PAttachDir = Trim(AttachDir) If Right(PAttachDir, 1) = "\" Then PAttachDir = Mid(PAttachDir, 1, Len(PAttachDir) - 1) TableName = GetFrom(TableSource) On Error Resume Next MkDir PAttachDir DelDir PAttachDir MkDir PAttachDir On Error GoTo 0 Rec.Open "Select f_Attach From " & TableName & " Where ID=" & RecID, Con If Rec.EOF Then Rec.Close: Set Rec = Nothing: Exit Function
On Error GoTo ERR1 Open PAttachDir & "\" & FileName For Binary Access Write As #1 On Error GoTo 0
Put 1, 1, Buffer Close 1
Loop Set Rec = Nothing Set Con = Nothing GetAttachFile = ConnectionStr Exit Function ERR1: GetAttachFile = Err.Description & "Path:" & PAttachDir & "\" & FileName End Function做成dll文件在delphi中如何调用啊! 这个字段里放了多个文件。 朋友能帮我把它用delphi写这个函数呢?(或者用delphi调用成功)(字段里的内容是长二进制数据) 我急用!!!谢谢!!!
在uses下定义: Function GetAttachFile(ConnectionStr:String;TableSource:String; RecID:String;AttachDir:String):String;stdcall;far;external "yoursdllname.dll" name "GetAttachFile" ; 试试
老大,string的机制是不一样的,怎么找得到?
不好意思,好像是单引号而不是双引号,最近VC跟DELPHI搞混了 给你一个例子吧: 这是我用VC写的一个动态库deskey.DLL中一个函数的定义: int __stdcall GetHex(LPSTR InStr,LPSTR OuStr,int Len) 这是我在DELPHI中的调用: uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; //加在下面 Function GetHex InStr:pchar;OuStr:pchar;Len:integer):integer;stdcall; far;External 'deskey.DLL' name 'GetHex';
youfunc = function GetAttachFile(con, TableName, ID ,imageLB_path):boolean;stdcall;
是这样的吗?
是不是应该
type
youfunc = function GetAttachFile(con, TableName, ID ,imageLB_path):boolean;stdcall;
youfunc = function GetAttachFile(con, TableName, ID ,imageLB_path):boolean;stdcall;
是这样的吗?
是不是应该
type
youfunc = function(con, TableName, ID ,imageLB_path):boolean;
@pfunc 还是为nil 这个是vb源程序Public Function GetAttachFile(ConnectionStr As String, TableSource As String, RecID As String, AttachDir As String) As String
Dim Con As New ADODB.Connection
Dim Rec As New ADODB.Recordset
Dim PAttachDir As String
Dim FileNameSize As Integer
Dim FileSize As Long
Dim FileName As String
Dim ExSize As Long, AcSize As Long
Dim Buffer() As Byte
Dim TableName As String
Con.Open ConnectionStr
PAttachDir = Trim(AttachDir)
If Right(PAttachDir, 1) = "\" Then PAttachDir = Mid(PAttachDir, 1, Len(PAttachDir) - 1)
TableName = GetFrom(TableSource)
On Error Resume Next
MkDir PAttachDir
DelDir PAttachDir
MkDir PAttachDir
On Error GoTo 0 Rec.Open "Select f_Attach From " & TableName & " Where ID=" & RecID, Con
If Rec.EOF Then Rec.Close: Set Rec = Nothing: Exit Function
ExSize = 0
AcSize = Rec("f_Attach").ActualSize
Do While ExSize < AcSize
FileNameSize = Val(Rec("f_Attach").GetChunk(8) & "")
Debug.Assert FileNameSize <> 0
FileName = Rec("f_Attach").GetChunk(FileNameSize)
FileSize = Val(Rec("f_Attach").GetChunk(32))
ReDim Buffer(FileSize - 1)
Buffer = Rec("f_Attach").GetChunk(FileSize)
ExSize = ExSize + 8 + 32 + FileNameSize + FileSize
m_Files.Add FileName
On Error GoTo ERR1
Open PAttachDir & "\" & FileName For Binary Access Write As #1
On Error GoTo 0
Put 1, 1, Buffer
Close 1
Loop
Set Rec = Nothing
Set Con = Nothing
GetAttachFile = ConnectionStr
Exit Function
ERR1:
GetAttachFile = Err.Description & "Path:" & PAttachDir & "\" & FileName
End Function做成dll文件在delphi中如何调用啊!
这个字段里放了多个文件。
朋友能帮我把它用delphi写这个函数呢?(或者用delphi调用成功)(字段里的内容是长二进制数据)
我急用!!!谢谢!!!
Function GetAttachFile(ConnectionStr:String;TableSource:String; RecID:String;AttachDir:String):String;stdcall;far;external "yoursdllname.dll" name "GetAttachFile" ;
试试
给你一个例子吧:
这是我用VC写的一个动态库deskey.DLL中一个函数的定义:
int __stdcall GetHex(LPSTR InStr,LPSTR OuStr,int Len)
这是我在DELPHI中的调用:
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;
//加在下面
Function GetHex InStr:pchar;OuStr:pchar;Len:integer):integer;stdcall;
far;External 'deskey.DLL' name 'GetHex';