Comprimir con Harbour + FW ... por favor...

Comprimir con Harbour + FW ... por favor...

Postby AngelSalom » Sun May 21, 2006 2:22 pm

Hola, holita gente.
Ando mareado de un lado a otro y no consigo entender si es posible realizar archivos comprimidos (me da igual ZIP, que cualquier otro formato) con Harbour + FW (si, ya se que xHarbour tiene la contribución HBZIP que es fabulosa y tal ... ) pero con Harbour no carbura... o soy yo que no se compilarla correctamente.
Y no me sirve usar Winexec () a programas externos, ya que tengo que controlar rigurosamente el proceso porque si falla algo debo saberlo.
Alguien conoce algún método ???

Mil gracias.
Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4
User avatar
AngelSalom
 
Posts: 727
Joined: Fri Oct 07, 2005 7:38 am
Location: Benicarló (Castellón ) - España

Intentando algo ...

Postby AngelSalom » Sun May 21, 2006 4:24 pm

He encontrado una dll zip32.dll que trae ejemplos en visual basic.
Lo cierto es que es la primera vez que intento esto, por lo tanto estoy muy "pardillo" en el tema, pero bueno.

Esto es lo que he hecho :

------ Este es el código en vb -------

Public Type ZIPUSERFUNCTIONS
DLLPrnt As Long
DLLPassword As Long
DLLComment As Long
DLLService As Long
End Type

Public Type ZPOPT
fSuffix As Long
fEncrypt As Long
fSystem As Long
fVolume As Long
fExtra As Long
fNoDirEntries As Long
fExcludeDate As Long
fIncludeDate As Long
fVerbose As Long
fQuiet As Long
fCRLF_LF As Long
fLF_CRLF As Long
fJunkDir As Long
fRecurse As Long
fGrow As Long
fForce As Long
fMove As Long
fDeleteEntries As Long
fUpdate As Long
fFreshen As Long
fJunkSFX As Long
fLatestTime As Long
fComment As Long
fOffsets As Long
fPrivilege As Long
fEncryption As Long
fRepair As Long
flevel As Byte
date As String
szRootDir As String
End Type

Public Type ZIPnames
s(0 To 99) As String
End Type

Public Declare Function ZpInit Lib "zip32.dll" (ByRef Zipfun As ZIPUSERFUNCTIONS) As Long

Public Declare Function ZpSetOptions Lib "zip32.dll" (ByRef Opts As ZPOPT) As Long

Public Declare Function ZpArchive Lib "zip32.dll" (ByVal argc As Long, ByVal funame As String, ByRef argv As ZIPnames) As Long

------------------------------------------------------------------------

--- Este es mi "intento" de traducirlo -------------
/* -----------------------------------------------------------------------------------
Pruebas con archivos ZIP
-----------------------------------------------------------------------------------
*/

#include "fivewin.ch"
#include "struct.ch"

Function Main()
Private oZipUserFunctions, ozPopt, oZipNames, oZipFun, oOpts, nArgC, cFuName, oArgV

STRUCT oZipUserFunctions
MEMBER DLLPrnt As DWORD
MEMBER DLLPassword As DWORD
MEMBER DLLComment As DWORD
MEMBER DLLService As DWORD
ENDSTRUCT

STRUCT oZpopt
MEMBER fSuffix As DWORD
MEMBER fEncrypt As DWORD
MEMBER fSystem As DWORD
MEMBER fVolume As DWORD
MEMBER fExtra As DWORD
MEMBER fNoDirEntries As DWORD
MEMBER fExcludeDate As DWORD
MEMBER fIncludeDate As DWORD
MEMBER fVerbose As DWORD
MEMBER fQuiet As DWORD
MEMBER fCRLF_LF As DWORD
MEMBER fLF_CRLF As DWORD
MEMBER fJunkDir As DWORD
MEMBER fRecurse As DWORD
MEMBER fGrow As DWORD
MEMBER fForce As DWORD
MEMBER fMove As DWORD
MEMBER fDeleteEntries As DWORD
MEMBER fUpdate As DWORD
MEMBER fFreshen As DWORD
MEMBER fJunkSFX As DWORD
MEMBER fLatestTime As DWORD
MEMBER fComment As DWORD
MEMBER fOffsets As DWORD
MEMBER fPrivilege As DWORD
MEMBER fEncryption As DWORD
MEMBER fRepair As DWORD
MEMBER flevel As DWORD
MEMBER date As STRING LEN 10
MEMBER szRootDir As STRING LEN 100
ENDSTRUCT

STRUCT oZipNames
MEMBER S As STRING
ENDSTRUCT


msginfo (ZpInit())
msginfo (ZpSetOptions())
msginfo (ZpArchive(1,"test.zip",{"test.obj"}))
Return (nil)

// Declaración de DLL32

DLL32 Function ZpInit (@oZipFun AS oZipUserFunctions) As DWORD PASCAL LIB "zip32.dll"
DLL32 Function ZpSetOptions (@oOpts AS oZpOpt) As DWORD PASCAL LIB "zip32.dll"
DLL32 Function ZpArchive (@nArgc AS DWORD,;
@cFuName AS STRING,;
@oArgV AS oZipNames) As DWORD PASCAL LIB "zip32.dll"
--------------------------------------------------------
bueno, tras esto la funcion zpinit y la funcion zpsetoptions se ejecutan sin problemas pero la zparchive me da un error harbour exception error, y supongo que habre definido mal alguno de los parámetros, pero ya os digo que ando muy verde ....
Alguien con experiencia puede hecharme una mano???

Gracias.
Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4
User avatar
AngelSalom
 
Posts: 727
Joined: Fri Oct 07, 2005 7:38 am
Location: Benicarló (Castellón ) - España

Postby Antonio Linares » Sun May 21, 2006 5:46 pm

Angel,

En vez de:
DLL32 Function ZpInit (@oZipFun AS oZipUserFunctions) ...

usa:
DLL Function ZpInit (oZipFun AS LPSTR) ...

y antes de llamarla haces:
local cBuffer := oZipUserFunctions:cBuffer
ZpInit( cBuffer )
oZipUserFunctions:cBuffer = cBuffer

igual con la otra
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42127
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby AngelSalom » Sun May 21, 2006 6:51 pm

Gracias por tu pronta respuesta, Antonio.
Pero parece que no va por ahi la cosa.
El tema es que creo que le tengo que pasar de alguna manera toda la estructura, porque de esta forma tan solo le paso un valor y sigue "petando" el programita.

STRUCT oZipUserFunctions
MEMBER DLLPrnt As DWORD
MEMBER DLLPassword As DWORD
MEMBER DLLComment As DWORD
MEMBER DLLService As DWORD
ENDSTRUCT

Fijate que la oZipUserFunctions tiene varias variables y no se como narices pasarlo para que no reviente.

Gracias.
Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4
User avatar
AngelSalom
 
Posts: 727
Joined: Fri Oct 07, 2005 7:38 am
Location: Benicarló (Castellón ) - España

Postby AngelSalom » Sun May 21, 2006 7:35 pm

Vaaaaaale, creo que lo voy pillando.
De la forma que me has dicho las dos primeras funciones van correctamente :

cBuffer:=oZipUserFunctions:cBuffer
msginfo (ZpInit (cBuffer))
oZipUserFunctions:cBuffer=cBuffer

cBuffer:=oZPopt:cBuffer
msginfo (ZpInit (cBuffer))
oZPopt:cBuffer=cBuffer

Pero en la funcion ZpArchive es donde peta y yo creo que es porque no se como declarar en la STRUCT oZipNames el formato del campo, en VisualBasic aparece asi :

Public Type ZIPnames
s(0 To 99) As String
End Type

Sabes como puedo traducirlo correctamente????

Gracias.
Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4
User avatar
AngelSalom
 
Posts: 727
Joined: Fri Oct 07, 2005 7:38 am
Location: Benicarló (Castellón ) - España

Postby Antonio Linares » Sun May 21, 2006 10:23 pm

Angel,

> s(0 To 99) As String

Eso parece un array de cadenas. De ser así, se podría declarar como:

MEMBER s1 AS LPSTR
MEMBER s2 AS LPSTR
MEMBER s3 AS LPSTR
...

así hasta 100.

Hay que confirmar que s(0 To 99) signifique eso. Igual quiere decir que es una cadena de 100 bytes, en cuyo caso, sería:

MEMBER s AS STRING LEN 100
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42127
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Es un array

Postby fleal » Mon May 22, 2006 2:02 am

Public Type ZIPnames
s(0 To 99) As String
End Type


s(0 To 99) As String

Es un array .NET usado en Visual Basic 2005. En Visual Basic 6 el indice inferior es 1, en la versión de VB 2005 el indice inferior es 0, por lo tanto indica valores de 0 a 99 dando un total de 100 elementos.

Saludos
Fernando Leal
fleal
 
Posts: 234
Joined: Tue Oct 25, 2005 12:39 am
Location: México, DF

Postby AngelSalom » Mon May 22, 2006 5:49 am

Naaada, que no hay forma.
Probaré con otra DLL a ver si tengo más suerte.

Ya os contare.
Un saludo.
Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4
User avatar
AngelSalom
 
Posts: 727
Joined: Fri Oct 07, 2005 7:38 am
Location: Benicarló (Castellón ) - España

Postby Antonio Linares » Mon May 22, 2006 8:33 am

Angel,

Si no consigues hacerlo funcionar desde PRG, entonces la solución es escribir la función en C directamente.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42127
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby RuFer » Mon May 22, 2006 4:50 pm

Angel:

Disculpa me entrometa en lo que estas haciendo:

Hay una utilidad hecha en xHarbour que se llama
xBLite y viene con PRG y todo, quizás sea mas
facil pasar esta a Harbour.

Esta muy completa, yo no la uso porque intente pasarla
a Harbour y realmente no pude.

Saludos.

Ruben Fernandez.
User avatar
RuFer
 
Posts: 140
Joined: Sat Oct 08, 2005 5:16 pm
Location: Uruguay

Postby AngelSalom » Mon May 22, 2006 5:00 pm

Te agradeceria que me indicaras desde donde descargarla, gracias.
Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4
User avatar
AngelSalom
 
Posts: 727
Joined: Fri Oct 07, 2005 7:38 am
Location: Benicarló (Castellón ) - España

Postby karinha » Mon May 22, 2006 5:40 pm

AngelSalom wrote:Te agradeceria que me indicaras desde donde descargarla, gracias.



http://busca.uol.com.br/www/index.html? ... backuplite
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7846
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 83 guests