Resourse From Dll(gif)

Iniciado por ntaryl, 25 Diciembre 2010, 12:52 PM

0 Miembros y 1 Visitante están viendo este tema.

ntaryl

Good  morning   

I play a litle with Resource File last night
Add a resource(gif) in a small project and is easy to load it from there in the form and show in listview.
Try to add the resourse(gif)in Dll and  call it from there but i cant 
Please can someone   help me with this   .or give me some tips 

thanks for the time

BlackZeroX

#1
.
Si es una dll Externa al ejecutable deberas usar

Código (vb) [Seleccionar]


Private Declare Function FreeLibrary Lib "KERNEL32" (ByVal hLib As Long) As Long 'BOOL
Private Declare Function LoadLibrary Lib "KERNEL32" Alias "LoadLibraryA" (ByVal strFilePath As String) As Long



Código (Vb) [Seleccionar]


Private Declare Function FindResource Lib "KERNEL32" Alias "FindResourceA" (ByVal hLib As Long, ByVal strName As String, ByVal strType As String) As Long
Private Declare Function FreeLibrary Lib "KERNEL32" (ByVal hLib As Long) As Long
Private Declare Function LoadResource Lib "KERNEL32" (ByVal hLib As Long, ByVal hRes As Long) As Long ' // handle of Resource
Private Declare Function LockResource Lib "KERNEL32" (ByVal hRes As Long) As Long ' // Get Pointer Of Resource
...
...



ligas de interes:
* http://www.recursosvisualbasic.com.ar/htm/listado-api/160-obtener-recurso-avi-de-archivo.htm
* http://wap.andreavb.com/forum/viewtopic_5214.html

Para reproducir un Gif nesesitaras cargar los "Fotogramas con un intevalo X de tiempo".
* http://www.recursosvisualbasic.com.ar/htm/trucos-codigofuente-visual-basic/59.htm

Temibles Lunas!¡.
.
The Dark Shadow is my passion.

ntaryl

Thanks  from the Reply 
But  i cant  solve  it   sorry   
If store res gif  in executable  work  fine   
from  dll   no   
Have a good  night 

ntaryl

Good  afternoon   
My friend i try but i cant.
Search around but find only the way with to add the dll as referense .Not like me this way .

This is the code i writte .i dont know if is correct  ?

Dim hLibrary As Long, hFind As Long
Dim hGif As Long
hLibrary = LoadLibrary(App.Path + "\Flags.dll")
If hLibrary = 0 Then
      MsgBox "Failed to load the specified library with error code " & Err.LastDllError
      Exit Sub
   End If
hFind = FindResource(hLibrary, "#111", "CUSTOM")
If hFind = 0 Then
     MsgBox "Failed to find Resource with error code " & Err.LastDllError
    Exit Sub
  End If
hGif = LoadResource(hLibrary, hFind)
If hGif = 0 Then
      MsgBox "Failed to load the specified resource with error code " & Err.LastDllError
      Exit Sub
      End If

this Files(Gifs) in Dll are Flags and add at runtime in imagelist and from there put in a listview .
I saw many ways how to load bmp from dll in another project .
if add the Flags in dll like Bmp then the dll Grow up  .

thanks for the time   


giorgos   

ntaryl

Thanks  for the replys 
Deside and Use Createobject and  load the gif from dll in  listview