*TIP* Access ANY Embedded File in your Application

Diablicolic

Centurion
Joined
Jul 28, 2003
Messages
167
Location
Your Neighbor
For what things looked like for when I discovered the magic:

Embedded File and Code Screenshot



This is the code to do what I have discovered:

Visual Basic:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim thisExe As System.Reflection.Assembly
        thisExe = System.Reflection.Assembly.GetExecutingAssembly()
        Dim file As System.IO.Stream = _
            thisExe.GetManifestResourceStream("Ith_Hack.Ith.html")

        Dim Readfile As New System.IO.StreamReader(file)
        Dim Ither As String
        Ither = Readfile.ReadToEnd
        Readfile.Close()

        Dim writer As New IO.StreamWriter(System.Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) & "/IthII.html")
        writer.Write(Ither)
        writer.Flush()
        writer.Close()

    End Sub

This basically saves the Ith.html onto the desktop, :)

btw Winston, thanks for nothing lol, :p
 
If you wanted to include files in the final application, such
as images or data files, but didn't want them as actual files on the
computer, you can have them compiled right into the final app.
The code that Diablicolic posted allows you to create a stream
from that compiled data (a resource) and access it at runtime.
As an example for what you could do with the resource, he
saves it to the desktop.
 
Back
Top