Можно ли загружать ресурсы из внешних dll.
Можно ли исопльзовать видео из файла ресурсов. т.е. нужно загрузить в контрол animation видео, хранящиеся в dll.
Private Const GENERIC_WRITE = &H40000000
Private Const FILE_SHARE_WRITE = &H2
Private Const CREATE_NEW = 1
Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long
Private Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long
Private Declare Function FindResource Lib "kernel32" Alias "FindResourceA" (ByVal hInstance As Long, ByVal lpName As String, ByVal lpType As String) As Long
Private Declare Function SizeofResource Lib "kernel32" (ByVal hInstance As Long, ByVal hResInfo As Long) As Long
Private Declare Function LoadResource Lib "kernel32" (ByVal hInstance As Long, ByVal hResInfo As Long) As Long
Private Declare Function LockResource Lib "kernel32" (ByVal hResData As Long) As Long
Private Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long, lpSecurityAttributes As Any, ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) As Long
Private Declare Function WriteFile Lib "kernel32" (ByVal hfile As Long, lpBuffer As Any, ByVal nNumberOfBytesToWrite As Long, lpNumberOfBytesWritten As Long, lpOverlapped As Any) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Sub Command1_Click()
Dim lib As Long
Dim ri As Long
Dim rd As Long
Dim hfile As Long
Dim wb As Long
lib = LoadLibrary("shell32.dll")
ri = FindResource(lib, "#150", "AVI")
rd = LoadResource(lib, ri)
hfile = CreateFile("shell32_#150.avi", GENERIC_WRITE, FILE_SHARE_WRITE, ByVal 0&, CREATE_NEW, 0, 0)
WriteFile hfile, ByVal LockResource(rd), SizeofResource(lib, ri), wb, ByVal 0&
CloseHandle hfile
FreeLibrary lib
End Sub
lib = LoadLibrary("shell32.dll")
ri = FindResource(lib, "#150", "icon")
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 27