Solved

How to play an AVI from a resource file

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

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…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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 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…

760 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

21 Experts available now in Live!

Get 1:1 Help Now