Foros del Web » Programación para mayores de 30 ;) » Programación General » Visual Basic clásico »

PARA DAVID EL GRANDE (PONER GIF ACÁ TE DEJO COMO SE HACE :p)

Estas en el tema de PARA DAVID EL GRANDE (PONER GIF ACÁ TE DEJO COMO SE HACE :p) en el foro de Visual Basic clásico en Foros del Web. BUE TE DEJO LA WEB DONDE PÚSE EL ARCHIVO COMPRIMIDO CON EL CÓDIGO (LA INSERCIÓN DEL GIF ES MEDIANTE LA OCX MARCHOSO.OCX) ESPERO TE SIRVA, ...
  #1 (permalink)  
Antiguo 06/09/2005, 13:02
Avatar de aldo1982  
Fecha de Ingreso: noviembre-2004
Ubicación: Santa Fe (Argentina) Colon F.C
Mensajes: 1.362
Antigüedad: 19 años, 5 meses
Puntos: 6
PARA DAVID EL GRANDE (PONER GIF ACÁ TE DEJO COMO SE HACE :p)

BUE TE DEJO LA WEB DONDE PÚSE EL ARCHIVO COMPRIMIDO CON EL CÓDIGO (LA INSERCIÓN DEL GIF ES MEDIANTE LA OCX MARCHOSO.OCX) ESPERO TE SIRVA, ACÁ VA EL LINK

http://usuarios.lycos.es/damianovich/CODFUENTE.php

PD: TE VAS A DAR CUENTA PORKE DICE "PARA DAVID EL GRANMDE" EJEJE

SALU2
__________________
LA MUERTE ESTÁ TAN SEGURA DE VENCER QUE NOS DA TODA UNA VIDA DE VENTAJA
  #2 (permalink)  
Antiguo 06/09/2005, 13:04
Avatar de GeoAvila
Colaborador
 
Fecha de Ingreso: diciembre-2003
Ubicación: Antigua Guatemala
Mensajes: 4.032
Antigüedad: 20 años, 4 meses
Puntos: 53
Pues no... al fin y al cabo no lo quería leer...


jejeje

nos vemos..
__________________
* Antes de preguntar lee las FAQ, y por favor no hagas preguntas en las FAQ
Sitio http://www.geoavila.com twitter: @GeoAvila
  #3 (permalink)  
Antiguo 06/09/2005, 13:05
Avatar de GeoAvila
Colaborador
 
Fecha de Ingreso: diciembre-2003
Ubicación: Antigua Guatemala
Mensajes: 4.032
Antigüedad: 20 años, 4 meses
Puntos: 53
por cierto ya le habías dado la repuesta en el otro post porque creaste un nuevo..?

como duda..

nos vemos..
__________________
* Antes de preguntar lee las FAQ, y por favor no hagas preguntas en las FAQ
Sitio http://www.geoavila.com twitter: @GeoAvila
  #4 (permalink)  
Antiguo 06/09/2005, 13:07
Avatar de aldo1982  
Fecha de Ingreso: noviembre-2004
Ubicación: Santa Fe (Argentina) Colon F.C
Mensajes: 1.362
Antigüedad: 19 años, 5 meses
Puntos: 6
Cita:
Iniciado por GeoAvila
por cierto ya le habías dado la repuesta en el otro post porque creaste un nuevo..?

como duda..

nos vemos..
SI ES VERDAD, PERO A ÉSTE POST NO LO CREE COMO DUDA, SOLO LO PUSE PARA KE DAVID LO TENGA MÁS A LA VISTA YA KE KIZAS NO KIERA ENTRAR AL OTRO JEEJEJ, PUEDES BORRAR ESTE POST SI KIERES...UN SALUDO
__________________
LA MUERTE ESTÁ TAN SEGURA DE VENCER QUE NOS DA TODA UNA VIDA DE VENTAJA
  #5 (permalink)  
Antiguo 06/09/2005, 14:59
Avatar de David
Moderador
 
Fecha de Ingreso: abril-2005
Ubicación: In this planet
Mensajes: 15.720
Antigüedad: 19 años
Puntos: 839
Desacuerdo

Cita:
Iniciado por aldo1982
SI ES VERDAD, PERO A ÉSTE POST NO LO CREE COMO DUDA, SOLO LO PUSE PARA KE DAVID LO TENGA MÁS A LA VISTA YA KE KIZAS NO KIERA ENTRAR AL OTRO JEEJEJ, PUEDES BORRAR ESTE POST SI KIERES...UN SALUDO
The link not function
__________________
Por favor, antes de preguntar, revisa la Guía para realizar preguntas.
  #6 (permalink)  
Antiguo 06/09/2005, 15:17
Avatar de aldo1982  
Fecha de Ingreso: noviembre-2004
Ubicación: Santa Fe (Argentina) Colon F.C
Mensajes: 1.362
Antigüedad: 19 años, 5 meses
Puntos: 6
Cita:
Iniciado por David el Grande
The link not function
ke raro, a mi si me anda, probá copiando y pegando en el browser del iexplorer.
salu2 cualkier cosa avisame , sino te lo mando a tu email
__________________
LA MUERTE ESTÁ TAN SEGURA DE VENCER QUE NOS DA TODA UNA VIDA DE VENTAJA
  #7 (permalink)  
Antiguo 06/09/2005, 15:53
Avatar de GeoAvila
Colaborador
 
Fecha de Ingreso: diciembre-2003
Ubicación: Antigua Guatemala
Mensajes: 4.032
Antigüedad: 20 años, 4 meses
Puntos: 53
ami tambien me sirvió..

no se cual se el problema..

nos vemos..
__________________
* Antes de preguntar lee las FAQ, y por favor no hagas preguntas en las FAQ
Sitio http://www.geoavila.com twitter: @GeoAvila
  #8 (permalink)  
Antiguo 06/09/2005, 19:39
 
Fecha de Ingreso: abril-2005
Mensajes: 351
Antigüedad: 19 años
Puntos: 3
una forma de ver giff animados sin utilizar ocx,y mediante codigo:

Insertar en el un formulario 2 commandbuton un timer y un image1(0) (matriz de control para ello en la propidedad index del image poner 0)

Codigo:

Option Explicit

Private FrameCount As Long

Private Const LB_DIR As Long = &H18D
Private Const DDL_ARCHIVE As Long = &H20
Private Const DDL_EXCLUSIVE As Long = &H8000
Private Const DDL_FLAGS As Long = DDL_ARCHIVE Or DDL_EXCLUSIVE

Private Declare Function SendMessage Lib "user32" _
Alias "SendMessageA" _
(ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) As Long

Private TotalFrames As Long

Private RepeatTimes As Long


Private Sub Command1_Click()
Dim nFrames As Long

'-------Remplazar la ruta del gif animado--------
nFrames = LoadGif("D:\Mis documentos\Visual Basic Proyectos\Otros\giff\a005_093.gif", Image1)

If nFrames > 0 Then


FrameCount = 0
Timer1.Interval = CLng(Image1(0).Tag)
Timer1.Enabled = True

End If
End Sub

Private Sub Command2_Click()
Timer1.Enabled = False
End Sub



Private Sub Timer1_Timer()

Dim i As Long

If FrameCount < TotalFrames Then

Image1(FrameCount).Visible = False
FrameCount = FrameCount + 1
Else
FrameCount = 0
For i = 1 To Image1.Count - 1
Image1(i).Visible = False
Next i
End If

Image1(FrameCount).Visible = True
Timer1.Interval = CLng(Image1(FrameCount).Tag)

End Sub


Private Function LoadGif(sFile As String, aImg As Variant) As Long

Dim hFile As Long
Dim sImgHeader As String
Dim sFileHeader As String
Dim sBuff As String
Dim sPicsBuff As String
Dim nImgCount As Long
Dim i As Long
Dim j As Long
Dim xOff As Long
Dim yOff As Long
Dim TimeWait As Long
Dim sGifMagic As String

If Dir$(sFile) = "" Or sFile = "" Then
MsgBox "File " & sFile & " not found", vbInformation
Exit Function
End If

'magic string signifying end of
'header and end of a gif frame
sGifMagic = Chr$(0) & Chr$(33) & Chr$(249)

If aImg.Count > 1 Then
For i = 1 To aImg.Count - 1
Unload aImg(i)
Next i
End If

'load the gif into a string buffer
hFile = FreeFile

Open sFile For Binary Access Read As hFile
sBuff = String(LOF(hFile), Chr(0))
Get #hFile, , sBuff
Close #hFile


i = 1
nImgCount = 0
j = InStr(1, sBuff, sGifMagic) + 1
sFileHeader = Left(sBuff, j)


If Left$(sFileHeader, 3) <> "GIF" Then
MsgBox "This file is not a *.gif file", vbInformation
Exit Function
End If

LoadGif = True

i = j + 2

If Len(sFileHeader) >= 127 Then
RepeatTimes& = Asc(Mid(sFileHeader, 126, 1)) + _
(Asc(Mid(sFileHeader, 127, 1)) * 256&)
Else
RepeatTimes = 0
End If

'create a temporary file in the current directory
hFile = FreeFile
Open "temp.gif" For Binary As hFile

'split out each frame of the gif, and
'write each the frame to the temporary file.
'Then load an image control for the frame,
'and load the temp file into that control.
Do

'increment counter
nImgCount = nImgCount + 1

'locate next frame end
j = InStr(i, sBuff, sGifMagic) + 3

'another check
If j > Len(sGifMagic) Then

'pad an output string, fill with the
'frame info, and write to disk. A header
'needs to be added as well, to assure
'LoadPicture recognizes it as a gif.
'Since VB's LoadPicture command ignores
'header info and loads animated gifs as
'static, we can safely reuse the header
'extracted above.
sPicsBuff = String(Len(sFileHeader) + j - i, Chr$(0))
sPicsBuff = sFileHeader & Mid(sBuff, i - 1, j - i)
Put #hFile, 1, sPicsBuff

'The first part of the
'extracted data is frame info
sImgHeader = Left(Mid(sBuff, i - 1, j - i), 16)

'embedded in the frame info is a
'field that represents the frame delay
TimeWait = ((Asc(Mid(sImgHeader, 4, 1))) + _
(Asc(Mid(sImgHeader, 5, 1)) * 256&)) * 10&

'assign the data.
If nImgCount > 1 Then

'if this is the second or later
'frame, load an image control
'for the frame
Load aImg(nImgCount - 1)

'the frame header also contains
'the x and y offsets of the image
'in relation to the first (0) image.
xOff = Asc(Mid(sImgHeader, 9, 1)) + _
(Asc(Mid(sImgHeader, 10, 1)) * 256&)

yOff = Asc(Mid(sImgHeader, 11, 1)) + _
(Asc(Mid(sImgHeader, 12, 1)) * 256&)

'position the image controls at
'the required position
aImg(nImgCount - 1).Left = aImg(0).Left + _
(xOff * Screen.TwipsPerPixelX)
aImg(nImgCount - 1).Top = aImg(0).Top + _
(yOff * Screen.TwipsPerPixelY)

End If

'use each control's .Tag property to
'store the frame delay period, and
'load the picture into the image control.
aImg(nImgCount - 1).Tag = TimeWait
aImg(nImgCount - 1).Picture = LoadPicture("temp.gif")

'update pointer
i = j
End If

'when the j = Instr() command above returns 0,
'3 is added, so if j = 3 there was no more
'data in the header. We're done.
Loop Until j = 3

'close and nuke the temp file
Close #hFile
Kill "temp.gif"

TotalFrames = aImg.Count - 1

LoadGif = TotalFrames
Exit Function

ErrHandler:

MsgBox "Error No. " & Err.Number & " when reading file", vbCritical
LoadGif = False
On Error GoTo 0

End Function
  #9 (permalink)  
Antiguo 06/09/2005, 20:53
Avatar de aldo1982  
Fecha de Ingreso: noviembre-2004
Ubicación: Santa Fe (Argentina) Colon F.C
Mensajes: 1.362
Antigüedad: 19 años, 5 meses
Puntos: 6
Cita:
Iniciado por LeandroA
una forma de ver giff animados sin utilizar ocx,y mediante codigo:

Insertar en el un formulario 2 commandbuton un timer y un image1(0) (matriz de control para ello en la propidedad index del image poner 0)

Codigo:

Option Explicit

Private FrameCount As Long

Private Const LB_DIR As Long = &H18D
Private Const DDL_ARCHIVE As Long = &H20
Private Const DDL_EXCLUSIVE As Long = &H8000
Private Const DDL_FLAGS As Long = DDL_ARCHIVE Or DDL_EXCLUSIVE

Private Declare Function SendMessage Lib "user32" _
Alias "SendMessageA" _
(ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) As Long

Private TotalFrames As Long

Private RepeatTimes As Long


Private Sub Command1_Click()
Dim nFrames As Long

'-------Remplazar la ruta del gif animado--------
nFrames = LoadGif("D:\Mis documentos\Visual Basic Proyectos\Otros\giff\a005_093.gif", Image1)

If nFrames > 0 Then


FrameCount = 0
Timer1.Interval = CLng(Image1(0).Tag)
Timer1.Enabled = True

End If
End Sub

Private Sub Command2_Click()
Timer1.Enabled = False
End Sub



Private Sub Timer1_Timer()

Dim i As Long

If FrameCount < TotalFrames Then

Image1(FrameCount).Visible = False
FrameCount = FrameCount + 1
Else
FrameCount = 0
For i = 1 To Image1.Count - 1
Image1(i).Visible = False
Next i
End If

Image1(FrameCount).Visible = True
Timer1.Interval = CLng(Image1(FrameCount).Tag)

End Sub


Private Function LoadGif(sFile As String, aImg As Variant) As Long

Dim hFile As Long
Dim sImgHeader As String
Dim sFileHeader As String
Dim sBuff As String
Dim sPicsBuff As String
Dim nImgCount As Long
Dim i As Long
Dim j As Long
Dim xOff As Long
Dim yOff As Long
Dim TimeWait As Long
Dim sGifMagic As String

If Dir$(sFile) = "" Or sFile = "" Then
MsgBox "File " & sFile & " not found", vbInformation
Exit Function
End If

'magic string signifying end of
'header and end of a gif frame
sGifMagic = Chr$(0) & Chr$(33) & Chr$(249)

If aImg.Count > 1 Then
For i = 1 To aImg.Count - 1
Unload aImg(i)
Next i
End If

'load the gif into a string buffer
hFile = FreeFile

Open sFile For Binary Access Read As hFile
sBuff = String(LOF(hFile), Chr(0))
Get #hFile, , sBuff
Close #hFile


i = 1
nImgCount = 0
j = InStr(1, sBuff, sGifMagic) + 1
sFileHeader = Left(sBuff, j)


If Left$(sFileHeader, 3) <> "GIF" Then
MsgBox "This file is not a *.gif file", vbInformation
Exit Function
End If

LoadGif = True

i = j + 2

If Len(sFileHeader) >= 127 Then
RepeatTimes& = Asc(Mid(sFileHeader, 126, 1)) + _
(Asc(Mid(sFileHeader, 127, 1)) * 256&)
Else
RepeatTimes = 0
End If

'create a temporary file in the current directory
hFile = FreeFile
Open "temp.gif" For Binary As hFile

'split out each frame of the gif, and
'write each the frame to the temporary file.
'Then load an image control for the frame,
'and load the temp file into that control.
Do

'increment counter
nImgCount = nImgCount + 1

'locate next frame end
j = InStr(i, sBuff, sGifMagic) + 3

'another check
If j > Len(sGifMagic) Then

'pad an output string, fill with the
'frame info, and write to disk. A header
'needs to be added as well, to assure
'LoadPicture recognizes it as a gif.
'Since VB's LoadPicture command ignores
'header info and loads animated gifs as
'static, we can safely reuse the header
'extracted above.
sPicsBuff = String(Len(sFileHeader) + j - i, Chr$(0))
sPicsBuff = sFileHeader & Mid(sBuff, i - 1, j - i)
Put #hFile, 1, sPicsBuff

'The first part of the
'extracted data is frame info
sImgHeader = Left(Mid(sBuff, i - 1, j - i), 16)

'embedded in the frame info is a
'field that represents the frame delay
TimeWait = ((Asc(Mid(sImgHeader, 4, 1))) + _
(Asc(Mid(sImgHeader, 5, 1)) * 256&)) * 10&

'assign the data.
If nImgCount > 1 Then

'if this is the second or later
'frame, load an image control
'for the frame
Load aImg(nImgCount - 1)

'the frame header also contains
'the x and y offsets of the image
'in relation to the first (0) image.
xOff = Asc(Mid(sImgHeader, 9, 1)) + _
(Asc(Mid(sImgHeader, 10, 1)) * 256&)

yOff = Asc(Mid(sImgHeader, 11, 1)) + _
(Asc(Mid(sImgHeader, 12, 1)) * 256&)

'position the image controls at
'the required position
aImg(nImgCount - 1).Left = aImg(0).Left + _
(xOff * Screen.TwipsPerPixelX)
aImg(nImgCount - 1).Top = aImg(0).Top + _
(yOff * Screen.TwipsPerPixelY)

End If

'use each control's .Tag property to
'store the frame delay period, and
'load the picture into the image control.
aImg(nImgCount - 1).Tag = TimeWait
aImg(nImgCount - 1).Picture = LoadPicture("temp.gif")

'update pointer
i = j
End If

'when the j = Instr() command above returns 0,
'3 is added, so if j = 3 there was no more
'data in the header. We're done.
Loop Until j = 3

'close and nuke the temp file
Close #hFile
Kill "temp.gif"

TotalFrames = aImg.Count - 1

LoadGif = TotalFrames
Exit Function

ErrHandler:

MsgBox "Error No. " & Err.Number & " when reading file", vbCritical
LoadGif = False
On Error GoTo 0

End Function
exelente aporte, si fera vos lo pondria en las FAQs mas hayá de con el control ocx se escribe menos código :P
__________________
LA MUERTE ESTÁ TAN SEGURA DE VENCER QUE NOS DA TODA UNA VIDA DE VENTAJA
  #10 (permalink)  
Antiguo 07/09/2005, 00:23
Avatar de Eternal Idol  
Fecha de Ingreso: mayo-2004
Ubicación: Lucentum
Mensajes: 6.192
Antigüedad: 20 años
Puntos: 74
Cita:
Iniciado por aldo1982
exelente aporte, si fera vos lo pondria en las FAQs mas hayá de con el control ocx se escribe menos código :P
Con el control OCX escribis menos codigo vos pero alguien escribe el control. Mucha gente prefiere hacer el codigo, otros prefieren usar componentes, es cuestion de gusto.
__________________
¡Peron cumple, Evita dignifica! VIVA PERON CARAJO
  #11 (permalink)  
Antiguo 07/09/2005, 06:38
Avatar de David
Moderador
 
Fecha de Ingreso: abril-2005
Ubicación: In this planet
Mensajes: 15.720
Antigüedad: 19 años
Puntos: 839
De acuerdo

Cita:
Iniciado por Eternal Idol
Con el control OCX escribis menos codigo vos pero alguien escribe el control. Mucha gente prefiere hacer el codigo, otros prefieren usar componentes, es cuestion de gusto.
Estoy de acuerdo, total los OCX no surgen de la nada ni mucho menos...
__________________
Por favor, antes de preguntar, revisa la Guía para realizar preguntas.
  #12 (permalink)  
Antiguo 07/09/2005, 06:48
Avatar de David
Moderador
 
Fecha de Ingreso: abril-2005
Ubicación: In this planet
Mensajes: 15.720
Antigüedad: 19 años
Puntos: 839
Pregunta

Lo único que me pregunto es para qué declaras el SendMessage y algunas constantes?????
__________________
Por favor, antes de preguntar, revisa la Guía para realizar preguntas.
  #13 (permalink)  
Antiguo 07/09/2005, 07:04
Avatar de David
Moderador
 
Fecha de Ingreso: abril-2005
Ubicación: In this planet
Mensajes: 15.720
Antigüedad: 19 años
Puntos: 839
Exclamación

Sí, el código funciona, hasta ahí todo bien, el problema surge con algunos tipos especiales de Gifs, no sé si ya vieron alguna vez Gifs que solo tienen la primera Imagen completa, y los otros es como si se "fusionaran" con la primera imagen, y tiene exactamente las coordenadas de donde debe colocarse esa imagen, el problema del código es ese, el no muestra correctamente este tipo de GIFs animados.....
__________________
Por favor, antes de preguntar, revisa la Guía para realizar preguntas.
  #14 (permalink)  
Antiguo 07/09/2005, 09:39
Avatar de aldo1982  
Fecha de Ingreso: noviembre-2004
Ubicación: Santa Fe (Argentina) Colon F.C
Mensajes: 1.362
Antigüedad: 19 años, 5 meses
Puntos: 6
Cita:
Iniciado por Eternal Idol
Con el control OCX escribis menos codigo vos pero alguien escribe el control. Mucha gente prefiere hacer el codigo, otros prefieren usar componentes, es cuestion de gusto.
CLARO KE SI ES VERDAD, BUE EN SI LAINTENSIÓN DE ESTO ES AYUDAR A DAVID, NO ESCRIBIR NI MENOS NI MÁS, YO SOLO PUSE MI GRANITO DE ARENA COMO TO2 LO HACEMOS.
SALU2
__________________
LA MUERTE ESTÁ TAN SEGURA DE VENCER QUE NOS DA TODA UNA VIDA DE VENTAJA
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 05:31.