Page 2 of 2

Re: Using 7Zip.dll in UNICODE [Resolved]

Posted: Sun Nov 10, 2019 2:50 am
by tester

Code: Select all

;
; PB 5.71 LTS (x86)
; 7Zip.dll IN UNICODE [Resolved]
; https://www.purebasic.fr/english/viewtopic.php?f=13&t=68262
; Latest 7-zip32.dll: http://www.csdinc.co.jp/archiver/lib/7-zip32.html#download
; 7-zip32 api doc: http://www.csdinc.co.jp/archiver/lib/7-zip32api-en.zip
;
EnableExplicit

Prototype.i SevenZip(Window.i, *CmdLine, *OutputAnsi, OutputSize.i)
Prototype.i SevenZipSetUnicodeMode(setUnicode.i)

Procedure$ SevenZipCmdLine(CmdLine$)
  Protected Id7Zip.i, wn, *CmdLine, Output$, OutputUTF8$
  Protected SevenZipSetUnicodeMode.SevenZipSetUnicodeMode
  Protected SevenZip.SevenZip
  Id7Zip=OpenLibrary(#PB_Any,"7-zip32.dll")
  If Id7Zip
    ;Debug "Library 7-zip32.dll opened"
    ;If ExamineLibraryFunctions(Id7Zip)
    ;  While NextLibraryFunction()
    ;    Debug LibraryFunctionName()
    ;  Wend
    ;EndIf
    
    SevenZipSetUnicodeMode=GetFunction(Id7Zip, "SevenZipSetUnicodeMode")
    If Not SevenZipSetUnicodeMode : Output$="SevenZipSetUnicodeMode procedure not present in 7-zip32.dll" : Goto SevenZipCmdLineOut : EndIf
    SevenZip=GetFunction(Id7Zip, "SevenZip")
    If Not SevenZip : Output$="SevenZip procedure not present in 7-zip32.dll" : Goto SevenZipCmdLineOut : EndIf
    wn=OpenWindow(#PB_Any, 300, 200, 320, 200, "7zip",#PB_Window_ScreenCentered|#PB_Window_Invisible)
    If wn
      OutputUTF8$ = Space(32767)
      *CmdLine = UTF8(CmdLine$)
      SevenZipSetUnicodeMode(#True) ; Return value always TRUE.
      If Not SevenZip(WindowID(wn), *CmdLine, @ OutputUTF8$, 32767)
        Output$=PeekS(@ OutputUTF8$, -1, #PB_UTF8)
      Else
        Output$="An error occurred."
      EndIf
      
    EndIf
  Else
    Output$="7-zip32.dll not present"
  EndIf
  
  SevenZipCmdLineOut:
  If Id7Zip : CloseLibrary(Id7Zip) : EndIf
  If *CmdLine : FreeMemory(*CmdLine) : EndIf
  
  ProcedureReturn Output$
EndProcedure

;Add to archive all files in the current directory
MessageRequester("", SevenZipCmdLine("a Test.zip *.*"))
;Test lists contents of the zip file
;Debug SevenZipCmdLine("l Test.zip")
MessageRequester("", SevenZipCmdLine("l TEST.zip"))

Re: Using 7Zip.dll in UNICODE [Resolved]

Posted: Mon May 20, 2024 5:33 am
by hoangdiemtinh
DLL files
---------

7za.dll and 7zxa.dll are reduced versions of 7z.dll from 7-Zip.
7za.dll and 7zxa.dll support only 7z format.
Note: 7z.dll is main DLL file that works with all archive types in 7-Zip.

7za.dll and 7zxa.dll support the following decoding methods:
- LZMA, LZMA2, PPMD, BCJ, BCJ2, COPY, 7zAES, BZip2, Deflate.

7za.dll also supports 7z encoding with the following encoding methods:
- LZMA, LZMA2, PPMD, BCJ, BCJ2, COPY, 7zAES.

7za.dll and 7zxa.dll work via COM interfaces.
But these DLLs don't use standard COM interfaces for objects creating.

Re: Using 7Zip.dll in UNICODE [Resolved]

Posted: Mon May 20, 2024 11:59 am
by mk-soft
hoangdiemtinh wrote: Mon May 20, 2024 5:33 am 7za.dll and 7zxa.dll work via COM interfaces.
But these DLLs don't use standard COM interfaces for objects creating.
What is the question?
7zip has no methods but standard call