Solved

How to play an AVI from a resource file

Posted on 1998-08-28
3
149 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…

929 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now