Solved

How to play an AVI from a resource file

Posted on 1998-08-28
3
157 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…

751 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