compiling and only one exe file

Posted on 2005-05-16
Last Modified: 2010-05-01
Hi all

I have a swf flash file embedded in vb application (vb 6.0)
now it is running but there are two files swf and vb application

When i compile it, i need only one exe file, that is vb application and swf file is compiled together (only one exe file)

I tried to use VB Recouse Editor, but i couldnt use it

How can i compile them together

thanks in advance

Question by:nurbek
    LVL 28

    Expert Comment

    Why couldn't you use the resource editor? You have to add them as Custom Resources.
    LVL 13

    Author Comment

    I added to custom Resources

    calling like
    myFlash.Movie = LoadResData(101, "CUSTOM")

    but it doesnt show the swf object
    LVL 13

    Author Comment

    when i use like this
    myFlash.Movie = App.Path & "\test.swf"

    it is working
    LVL 28

    Accepted Solution

    You cannot do that. You will have to extract the swf file from the exe to a temp file while your app runs,then kill the file when your app closes. Here is an example:

    Private Sub Form_Load()
    Dim swfFile As String
    ' location to save file to,it will be extracted from .exe
    swfFile = Environ("Temp") & "\" & "myfile.swf"

    'save Resource item 101 to disk
    SaveResItemToDisk 101, "Custom", swfFile

    ' Load your swfFile
    ShockwaveFlash1.Movie = swfFile

    End Sub

    Private Sub Form_Unload(Cancel As Integer)
    Dim swfFile As String
    swfFile = Environ("Temp") & "\" & "myfile.swf"

    ' kill the file when your app unloads
    If Dir(swfFile) <> "" Then
        Kill swfFile
    End If

    End Sub

    Private Function SaveResItemToDisk(ByVal iResourceNum As Integer, _
      ByVal sResourceType As String, ByVal sDestFileName As String) As Long
    Dim bytResourceData()   As Byte
    Dim iFileNumOut         As Integer
    On Error GoTo SaveResItemToDisk_err
    bytResourceData = LoadResData(iResourceNum, sResourceType)
    iFileNumOut = FreeFile
    Open sDestFileName For Binary Access Write As #iFileNumOut
    Put #iFileNumOut, , bytResourceData
    Close #iFileNumOut
    SaveResItemToDisk = 0
    Exit Function
    SaveResItemToDisk = Err.Number
    End Function
    LVL 13

    Author Comment

    thank you, it works :)


    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    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 …
    You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
    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…

    754 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

    17 Experts available now in Live!

    Get 1:1 Help Now