Re: UnRAROCX.ocx and unrar.dll
From: Ben S (benscarboro_at_hotmail.com)
Date: 02/02/04
- Next message: solex: "XML and the Datagrid"
- Previous message: adam: "multitask visualbasic.net"
- In reply to: Tom Shelton: "Re: UnRAROCX.ocx and unrar.dll"
- Next in thread: Tom Shelton: "Re: UnRAROCX.ocx and unrar.dll"
- Reply: Tom Shelton: "Re: UnRAROCX.ocx and unrar.dll"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 2 Feb 2004 20:09:48 -0000
Hello Tom,
OK, these are the original Strutures and DLL declares.
(from the VB6 Expamle)
Private Type RARHeaderData
ArcName As String * 260
FileName As String * 260
Flags As Long
PackSize As Long
UnpSize As Long
HostOS As Long
FileCRC As Long
FileTime As Long
UnpVer As Long
Method As Long
FileAttr As Long
CmtBuf As String
CmtBufSize As Long
CmtSize As Long
CmtState As Long
End Type
Private Type RAROpenArchiveData
ArcName As String
OpenMode As Long
OpenResult As Long
CmtBuf As String
CmtBufSize As Long
CmtSize As Long
CmtState As Long
End Type
Private Declare Function RAROpenArchive Lib "unrar.dll" (ByRef ArchiveData
As RAROpenArchiveData) As Long
Private Declare Function RARCloseArchive Lib "unrar.dll" (ByVal hArcData As
Long) As Long
Private Declare Function RARReadHeader Lib "unrar.dll" (ByVal hArcData As
Long, ByRef HeaderData As RARHeaderData) As Long
Private Declare Function RARProcessFile Lib "unrar.dll" (ByVal hArcData As
Long, ByVal Operation As Long, ByVal DestPath As String, ByVal DestName As
String) As Long
Private Declare Sub RARSetChangeVolProc Lib "unrar.dll" (ByVal hArcData As
Long, ByVal Mode As Long)
Private Declare Sub RARSetPassword Lib "unrar.dll" (ByVal hArcData As Long,
ByVal Password As String)
-------------------------------New------------------
These are the structures and DLL calls I used after changing them:
Private Type RARHeaderData
ArcName As String
FileName As String
Flags As Integer
PackSize As Integer
UnpSize As Integer
HostOS As Integer
FileCRC As Integer
FileTime As Integer
UnpVer As Integer
Method As Integer
FileAttr As Integer
CmtBuf As String
CmtBufSize As Integer
CmtSize As Integer
CmtState As Integer
End Type
Private Type RAROpenArchiveData
ArcName As String
OpenMode As Integer
OpenResult As Integer
CmtBuf As String
CmtBufSize As Integer
CmtSize As Integer
CmtState As Integer
End Type
Private Declare Function RAROpenArchive Lib "unrar.dll" (ByRef ArchiveData
As RAROpenArchiveData) As Integer
Private Declare Function RARCloseArchive Lib "unrar.dll" (ByVal hArcData As
Integer) As Integer
Private Declare Function RARReadHeader Lib "unrar.dll" (ByVal hArcData As
Integer, ByRef HeaderData As RARHeaderData) As Integer
Private Declare Function RARProcessFile Lib "unrar.dll" (ByVal hArcData As
Integer, ByVal Operation As Integer, ByVal DestPath As String, ByVal
DestName As String) As Integer
Private Declare Sub RARSetChangeVolProc Lib "unrar.dll" (ByVal hArcData As
Integer, ByVal Mode As Integer)
Private Declare Sub RARSetPassword Lib "unrar.dll" (ByVal hArcData As
Integer, ByVal Password As String)
I've also tried making the strings like this in the structure this:
<MarshalAs(UnmanagedType.LPTStr, SizeConst:=260)>Dim ArcName as String
And the same for FileName and CmtBuf but it still brings up the same error
"An unhandled exception of type 'System.NullReferenceException; occured in
RarOCXTest.exe
Additional information: Object reference not set to an instance of an
object."
Hope that's of some use. It all seems to be OK to me, but I can't spot
where I'm going wrong
Thanks
Ben S
--- > I haven't used either - but the null reference exception is more then > likely because of improper declaration. Can you post your declaration > of the function and the original C/C++ prototype? > > -- > Tom Shelton [MVP] > Powered By Gentoo Linux 1.4 > "I teleported home one night > With Ron and Sid and Meg. > Ron stole Meggie's heart away > And I got Sidney's leg." > > - A poem about matter transference beams.
- Next message: solex: "XML and the Datagrid"
- Previous message: adam: "multitask visualbasic.net"
- In reply to: Tom Shelton: "Re: UnRAROCX.ocx and unrar.dll"
- Next in thread: Tom Shelton: "Re: UnRAROCX.ocx and unrar.dll"
- Reply: Tom Shelton: "Re: UnRAROCX.ocx and unrar.dll"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|