#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2002
    Posts
    20
    Rep Power
    0

    Problems handling .RES files


    Hello, I have a problem handling .RES files in Visual Basic that I really hope you will help me to solve.

    In particular, I cannot launch an embedded .AVI file after having compiled it by means of the Resource Compiler you can find in the VB CD-ROM.

    The procedure I followed is the following:

    1. I created an .RC file containing the following line of code:

    101 AVI DISCARDABLE "TEST.AVI"

    2. I embedded the .AVi file (TEST.AVI) into a resource file (TEST.RES) using RC.EXE.

    3. I added TEST.RES to the VB project and placed the following code in the General Declarations window of Form1:

    Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As Any, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long

    4. Finally, I typed the following code in the click event of a command button:

    Private Sub cmdPlayAviRes_Click()
    Dim RetValue As Long
    Dim AviArray() As Byte
    Dim strCmdStr As String
    AviArray = LoadResData(101, "AVI")
    strCmdStr = "play " & AviArray(0) & " "
    RetValue = mciSendString(strCmdStr, 0&, 0, 0&)
    End Sub

    The code above works perfectly, with some modifications, when dealing with .WAV files. Unfortunately, it seems not to work with .AVI files: clicking on the command button produces no results. Where did I make a mistake?

    Thanks for your attention. I'm counting on your help.

    Pasquale Esposito
    Perugia - Italy
    http://www.toprete.com/software/
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    Cheltenham, England.
    Posts
    101
    Rep Power
    15
    Silly question, perhaps, but do you have the necessary association for .AVI files on the target system? What happens if you double-click on an AVI file in Windows Explorer on the target PC?
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2002
    Posts
    20
    Rep Power
    0
    .AVI files are associated to Windows Media Player, on both the source and target computer.

    To tell the truth, I have already found a way to work around the problem: first I import the .RES file containing the .AVI movie, then I save it in a temporary file on the hard disk and, finally, I delete it after having played it. What I don't like of this solution is the fact that I have to create a temporary file on the local computer: this slows down the execution of the movie which can only start after the temporary file has been created. That's why I am exploring the possibility of playing .AVI movies directly from the embedded .RES file. Do you know how - and if - it is possible?
  6. #4
  7. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    Cheltenham, England.
    Posts
    101
    Rep Power
    15
    Sorry, no - you're way ahead of me in this area.
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2002
    Posts
    20
    Rep Power
    0
    No problem. Thank you anyway.

IMN logo majestic logo threadwatch logo seochat tools logo