Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to play an AVI from a resource file

Posted on 1998-08-28
3
Medium Priority
?
163 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 800 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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses

877 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