Solved

How to play an AVI from a resource file

Posted on 1998-08-28
3
154 Views
Last Modified: 2010-04-30
I have a reourcefile (.res) containing an AVI movie. Is it possible (I hope it is) to access this file and by using MMC use actions like play,stop etc on this movie. Maybe you also have suggestions how to write the resourcefile. I compile it through rc 5.0 (Microsoft).
0
Comment
Question by:rogerolofsson
3 Comments
 
LVL 4

Accepted Solution

by:
mcix earned 200 total points
ID: 1431572
The following code will load AVI from a Resource file into a Temporary File on the Temp Directory...

The File Prefix is Set to AVI and of course the file extension will be TMP.   

Private Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Private Declare Function GetTempFileName Lib "kernel32" Alias "GetTempFileNameA" (ByVal lpszPath As String, ByVal lpPrefixString As String, ByVal wUnique As Long, ByVal lpTempFileName As String) As Long
Private Const FILE_MAX_PATH As Integer = 255
Private Const FILE_AVI_PREFIX As String = "AVI"

Private mstrTempPath As String * 255        ' Temporary Path
Private mstrTempFile As String * 255        ' Temporary File

Private Sub Form_Load()

    Dim bytAVIFile() As Byte                ' AVI File Byte Array
    Dim mlngResult As Long                  ' API Result Returned
    Dim mlngFileHandle As Long              ' AVI File Handle
    
    
    ' Get Temp Path and File Name
    mlngResult = GetTempPath(FILE_MAX_PATH, mstrTempPath)
    mlngResult = GetTempFileName(mstrTempPath, FILE_AVI_PREFIX, 0, mstrTempFile)
    
    ' Load AVI File into a Byte Array
    bytAVIFile = LoadResData(101, "CUSTOM")
    
    
    ' Open the Temp File As Binary
    
    mlngFileHandle = FreeFile
    Open mstrTempFile For Binary As #mlngFileHandle
    
    ' Insert the Byte Array into Temp File
    
    Put #mlngFileHandle, 1, bytAVIFile()
    
    ' Close Temp File
    
    Close #mlngFileHandle
    
    ' Set MCI Control to Temp File
    ActiveMovie1.FileName = mstrTempFile

End Sub

Private Sub Form_Unload(Cancel As Integer)
    
    ' Set MCI Control File Name to Nothing
    
    ActiveMovie1.FileName = "" 
    
    ' Erase Temp file
    
    Kill mstrTempFile
End Sub
0
 
LVL 14

Expert Comment

by:waty
ID: 1431573
The same question was posted yesterday, before yesterday...
0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1431574
Bought This Question.
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question