
Before i use a code for use 7Zip.dll with PB
Since PB passing in UNICODE this code not works anymore

I have try to translate variable in ASCII but nothing works
If someone know how use it in the new version of PB
Code: Select all
Procedure.s SevenZipDossier(PbIdForm, Path7Zip.s, FolderSource.s, PathDestination.s)
Id7Zip = OpenLibrary(#PB_Any, Path7Zip)
If Id7Zip
If FileSize(FolderSource) = - 2
PathAddBackslash_(@PathDestination)
PathAddBackslash_(@FolderSource)
NameZipFile$ = StringField(FolderSource, CountString(FolderSource, "\"), "\") + ".zip"
NameZipFile$ = PathDestination + NameZipFile$
*bufFolderSource = AllocateMemory(Len(FolderSource))
PokeS(*bufFolderSource, FolderSource, -1, #PB_Ascii)
*bufNameZipFile = AllocateMemory(Len(NameZipFile$))
PokeS(*bufNameZipFile, NameZipFile$, -1, #PB_Ascii)
OutputAnsi.s = Space(255)
CmdLine$ = "a -tzip -mx7 -ir!" + #DQUOTE$ + PeekS(*bufFolderSource, Len(FolderSource), #PB_Ascii) + "*.*" + #DQUOTE$ + " " + #DQUOTE$ + PeekS(*bufNameZipFile, Len(NameZipFile$), #PB_Ascii) + #DQUOTE$
CallFunction(Id7Zip, "SevenZip", WindowID(PbIdForm), @CmdLine$, @OutputAnsi, 255)
AnsiLen = Len(OutputAnsi)
UniLen = MultiByteToWideChar_(#CP_ACP, 0, OutputAnsi, AnsiLen, 0, 0)
If UniLen
*Unicode = SysAllocStringLen_(0, UniLen)
MultiByteToWideChar_(#CP_ACP, 0, OutputAnsi, AnsiLen, *Unicode, UniLen)
EndIf
Output.s = PeekS(*Unicode)
Debug Output
EndIf
CloseLibrary(Id7Zip)
EndIf
EndProcedure
#Window = 0
OpenWindow(#Window, x, y, 100, 100, "7zip")
SevenZipDossier(#Window, "C:\Temp\7-zip32.dll", "C:\Temp\FolderToZip\", "C:\Temp\")