请教,VB6程序转成VB.net报Addressof表达式不能转换为long,因为long不是委托类型
程序如下:
'-- UNZIP32.DLL Userfunctions Structure
Structure USERFUNCTION
Public UZDLLPrnt As Long ' Pointer To Apps Print Function
Public UZDLLSND As Long ' Pointer To Apps Sound Function
Public UZDLLREPLACE As Long ' Pointer To Apps Replace Function
Public UZDLLPASSWORD As Long ' Pointer To Apps Password Function
Public UZDLLMESSAGE As Long ' Pointer To Apps Message Function
Public UZDLLSERVICE As Long ' Pointer To Apps Service Function (Not Coded!)
Public TotalSizeComp As Long ' Total Size Of Zip Archive
Public TotalSize As Long ' Total Size Of All Files In Archive
Public CompFactor As Long ' Compression Factor
Public NumMembers As Long ' Total Number Of All Files In The Archive
Public cchComment As Integer ' Flag If Archive Has A Comment!
End Structure
Public Function FnPtr(ByVal lp As Long) As Long
FnPtr = lp
End Function
Public Function UZDLLPrnt(ByRef fname As UNZIPCBChar, ByVal x As Long) As Long
Dim s0 As String
Dim xx As Long
'-- Always Put This In Callback Routines!
On Error Resume Next
s0 = ""
'-- Gets The UNZIP32.DLL Message For Displaying.
For xx = 0 To x - 1
If fname.ch(xx) = 0 Then Exit For
s0 = s0 & Chr(fname.ch(xx))
Next
'-- Assign Zip Information
If Mid$(s0, 1, 1) = vbLf Then s0 = vbNewLine ' Damn UNIX :-)
UZDLLPrnt = 0
End Function
Public Function VBUnZip32(ByVal uzdcl As DCLIST, ByVal uZipNames As UNZIPnames, ByVal uNumberFiles As Long, ByVal uNumberXFiles As Long, _
ByVal uExcludeNames As UNZIPnames) As Long
Dim retcode As Long
Dim MsgStr As String
Dim UZUSER As USERFUNCTION
Dim UZVER As UZPVER
Dim _UZDLLPrnt = New delegateUZDLLPrnt(AddressOf UZDLLPrnt)
retcode = 1
'-- Set Callback Addresses
'-- (WARNING!!!) Do Not Change
UZUSER.UZDLLPrnt = FnPtr(AddressOf UZDLLPrnt)
UZUSER.UZDLLSND = 0& '-- Not Supported
UZUSER.UZDLLREPLACE = FnPtr(AddressOf UZDLLRep)
UZUSER.UZDLLPASSWORD = FnPtr(AddressOf UZDLLPass)
UZUSER.UZDLLMESSAGE = FnPtr(AddressOf UZReceiveDLLMessage)
UZUSER.UZDLLSERVICE = FnPtr(AddressOf UZDLLServ)
问题出在highlighted ,问题非常急,请各位帮忙,谢谢。
'-- UNZIP32.DLL Userfunctions Structure
Structure USERFUNCTION
Public UZDLLPrnt As Long ' Pointer To Apps Print Function
Public UZDLLSND As Long ' Pointer To Apps Sound Function
Public UZDLLREPLACE As Long ' Pointer To Apps Replace Function
Public UZDLLPASSWORD As Long ' Pointer To Apps Password Function
Public UZDLLMESSAGE As Long ' Pointer To Apps Message Function
Public UZDLLSERVICE As Long ' Pointer To Apps Service Function (Not Coded!)
Public TotalSizeComp As Long ' Total Size Of Zip Archive
Public TotalSize As Long ' Total Size Of All Files In Archive
Public CompFactor As Long ' Compression Factor
Public NumMembers As Long ' Total Number Of All Files In The Archive
Public cchComment As Integer ' Flag If Archive Has A Comment!
End Structure
Public Function FnPtr(ByVal lp As Long) As Long
FnPtr = lp
End Function
Public Function UZDLLPrnt(ByRef fname As UNZIPCBChar, ByVal x As Long) As Long
Dim s0 As String
Dim xx As Long
'-- Always Put This In Callback Routines!
On Error Resume Next
s0 = ""
'-- Gets The UNZIP32.DLL Message For Displaying.
For xx = 0 To x - 1
If fname.ch(xx) = 0 Then Exit For
s0 = s0 & Chr(fname.ch(xx))
Next
'-- Assign Zip Information
If Mid$(s0, 1, 1) = vbLf Then s0 = vbNewLine ' Damn UNIX :-)
UZDLLPrnt = 0
End Function
Public Function VBUnZip32(ByVal uzdcl As DCLIST, ByVal uZipNames As UNZIPnames, ByVal uNumberFiles As Long, ByVal uNumberXFiles As Long, _
ByVal uExcludeNames As UNZIPnames) As Long
Dim retcode As Long
Dim MsgStr As String
Dim UZUSER As USERFUNCTION
Dim UZVER As UZPVER
Dim _UZDLLPrnt = New delegateUZDLLPrnt(AddressOf UZDLLPrnt)
retcode = 1
'-- Set Callback Addresses
'-- (WARNING!!!) Do Not Change
UZUSER.UZDLLPrnt = FnPtr(AddressOf UZDLLPrnt)
UZUSER.UZDLLSND = 0& '-- Not Supported
UZUSER.UZDLLREPLACE = FnPtr(AddressOf UZDLLRep)
UZUSER.UZDLLPASSWORD = FnPtr(AddressOf UZDLLPass)
UZUSER.UZDLLMESSAGE = FnPtr(AddressOf UZReceiveDLLMessage)
UZUSER.UZDLLSERVICE = FnPtr(AddressOf UZDLLServ)
问题出在highlighted ,问题非常急,请各位帮忙,谢谢。
...全文
相关推荐
vb.net 委托的例子
掌握委托的使用对于编写复杂的、可扩展的VB.NET应用程序至关重要。
vb.net 委托与非委托对线程的影响
在VB.NET编程中,线程控制是多任务应用程序的核心部分,特别是当涉及到用户界面(UI)更新时。本文将深入探讨“委托”和“非委托”在子线程与UI线程交互中的作用,以及它们如何影响程序的性能和响应性。
VB.net 事物委托,多控件使用同一事件源码实例
在VB.NET中,Delegate关键字用于定义委托类型。事件通常与委托一起使用,因为事件处理器实际上是通过委托调用的。
vb.net中委托的例子
在VB.NET编程中,委托是一种强大的工具,它允许我们把方法作为参数传递,或者实现事件处理。本篇文章将深入探讨委托的概念,以及如何在VB.NET中声明和使用它们,通过一个具体的实例进行详细讲解。
C#和Vb 的多播委托 事件
C#和VB.NET都支持多播委托的声明、实例化和使用,尽管语法上有所不同,但其核心概念和功能是相同的。在编写事件驱动的应用程序时,多播委托提供了强大的工具,允许对象之间以松耦合的方式协同工作。


