VB.NET Process.start() Run Embedded Resource File (Exe,Bitmap,Audio,Txt)

VB.NET tutorials : How to Process.start() Method to Run Embedded Resource File (Exe,Bitmap,Audio,Txt) using .NET for beginners

VB.NET For Beginners - How can i run (Exe, Txt, Audio, Images) Files from Embedded/Resources without extracting to file first using vb.net? If you want to execute an executable embedded file for example the .EXE files into your program, without extracting it to disk first, i think it's possible. But, you must know it is very, very, hard to do.
Please Read :
VB.NET Crud Operations with Metro Styles

What you have to do is, and note that I do not know all the details about this since I don't do this, but anyway :
  1. First you must Load the executable code into memory.
  2. Remap all addresses in the binary image, so that they're correct in relation to the base address you loaded the executable at.
  3. Possibly load external references, ie. other DLL's that executable needed.
  4. Then, Remap the addresses of those references.
  5. Possibly load references needed by the just loaded referenced DLL's
  6. Remap those dll's.
  7. Repeat 3 through 6 until done
  8. Call the code.
i think you can't do it, so please follow my thread and you will get the same value. i'll extract my embedded resource files to Disk, and then remove it.

Run Embedded Resource File (Exe)

Just create a new project in your visual studio, then rename it with "EmbeddedResource", on the Form1.vb at your project add one Button look like this images :

vb net Run Embedded Resource File

How to add Embedded Resources File?

at the Solution Explorer windows > right click on your project > click Properties.
then go to Resources Menu and Add Resources, please see the images below :

After done, back to Form1.vb and we will write all source code, just write all source code below in the Fomr1.Vb

Source Code Run Embedded Resource :

Imports System.IO ' using system IO namespaces
Public Class Form1
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        ' declare the file name in resources filder
        ' NETConverter.exe is our resource files
        Dim FilePath As String = Application.StartupPath & "\NETConverter.exe"
        Using MsiFile As New FileStream(FilePath, FileMode.Create)
            MsiFile.Write(My.Resources.NETConverter, 0, My.Resources.NETConverter.Length)
        End Using
        ' open the resources files
        Process.Start(FilePath)
    End Sub
    Public Function ProcessRunning(ByVal name As String) As Boolean
        'Check if the process is runing. As ERROR handler.
        For Each CloseProcess As Process In Process.GetProcesses()
            If CloseProcess.ProcessName.StartsWith(name) Then
                'process found running!!! 
                Return False
            End If
        Next
        'process not found, So it is finaly been killed!!!
        Return True
    End Function

    Private Sub Form1_FormClosed(sender As Object, e As FormClosedEventArgs) Handles MyBase.FormClosed

        'To kill the NETConverter.exe Process.
        Dim MyProcess() As Process = System.Diagnostics.Process.GetProcessesByName("NETConverter")
        For Each s As Process In MyProcess
            ' kill the process
            s.Kill()
        Next
        'To delete the NETConverter.exe file from the directory.
        If ProcessRunning("NETConverter") Then
            Dim fileDeleted As String = My.Application.Info.DirectoryPath + "\NETConverter.exe"
            If File.Exists(fileDeleted) = True Then
                File.Delete(fileDeleted)
            End If
        Else : Form1_FormClosed(sender, e)
        End If
    End Sub
End Class

Just press "F5" keys to debugging your simple applications and let me know what happen.

if you still confusing with this tutorial, just view the video below :

Video tutorial How to Run Embedded Resource File (Exe,Bitmap,Audio,Txt)



Download Full Source Code Run Embedded Resource File

COMMENTS

Next Recomended


Feel free to code it up and send us a pull request.

Hi everyone, let's me know how much this lesson can help your work. Please Subscribe and Follow Our Social Media 'kodeajaib[dot]com' to get Latest tutorials and will be send to your email everyday for free!, Just hit a comment if you have confused. Nice to meet you and Happy coding :) all ^^



Follow by E-Mail


Name

ADO.NET,3,Ajax,6,Android,9,AngularJS,4,ASP.NET,4,Blogger Tutorials,7,Bootstrap,7,C++,1,Codeigniter,2,Cplusplus,6,Crystal Report,6,CSharp,25,Ebook Java,2,FlyExam,1,FSharp,3,Game Development,2,Java,35,JDBC,2,Laravel,84,Lumen,2,MariaDB,2,Ms Access,3,MySQL,31,ODBC,6,OleDB,1,PHP,14,PHP Framework,5,PHP MYSQLI,9,PHP OOP,5,Python,8,Python 3,4,SQL Server,4,SQLite,4,Uncategorized,5,Vb 6,2,Vb.Net,89,Video,48,Vue Js,4,WPF,2,Yii,3,
ltr
item
KODE AJAIB: VB.NET Process.start() Run Embedded Resource File (Exe,Bitmap,Audio,Txt)
VB.NET Process.start() Run Embedded Resource File (Exe,Bitmap,Audio,Txt)
VB.NET tutorials : How to Process.start() Method to Run Embedded Resource File (Exe,Bitmap,Audio,Txt) using .NET for beginners
https://1.bp.blogspot.com/-pJpP-__unJw/V5JfIme9NtI/AAAAAAAACHg/4E3QX3R9QTsdCP2YcygavWVFW7uDrETzQCLcB/s1600/run-embedded-resources.jpg
https://1.bp.blogspot.com/-pJpP-__unJw/V5JfIme9NtI/AAAAAAAACHg/4E3QX3R9QTsdCP2YcygavWVFW7uDrETzQCLcB/s72-c/run-embedded-resources.jpg
KODE AJAIB
https://www.kodeajaib.com/2016/07/vbnet-run-embedded-resources-files.html
https://www.kodeajaib.com/
https://www.kodeajaib.com/
https://www.kodeajaib.com/2016/07/vbnet-run-embedded-resources-files.html
true
3214704946184383982
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy