|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
trying to extract .exe from resourceat runtime, so i can execute it and then remove it. my code is below strm always is Nothing any ideas. thanks in advance Dim asm As System.Reflection.Assembly = System.Reflection.Assembly.GetExecutingAssembly() Dim resourceName As String = asm.GetName().Name + ".filename.exe" Dim strm As System.IO.Stream = asm.GetManifestResourceStream(resourceName) Dim buffer() As Byte = New Byte(strm.Length) {} strm.Read(buffer, 0, CInt(buffer.Length)) strm.Close() Dim tempName As String = System.IO.Path.GetTempFileName() Dim fs As New System.IO.FileStream(tempName, System.IO.FileMode.Create) fs.Write(buffer, 0, CInt(buffer.Length)) fs.Close() -- ------------------ Jesterware DVD Audio Ripper - The ultimate DVD to mp3/ogg/wav/aac Utility. http://www.jesterware.co.uk fixed..
thanks anyway. -- Show quote------------------ Jesterware DVD Audio Ripper - The ultimate DVD to mp3/ogg/wav/aac Utility. http://www.jesterware.co.uk "Nige" <nkarn***@blueyonder.co.uk> wrote in message news:eEoZs96CGHA.4000@TK2MSFTNGP10.phx.gbl... >I have an exe embedded in my vb.net application and I'm trying to extract >it at runtime, so i can execute it and then remove it. > > my code is below > > strm always is Nothing > > any ideas. > > thanks in advance > > Dim asm As System.Reflection.Assembly = > System.Reflection.Assembly.GetExecutingAssembly() > > Dim resourceName As String = asm.GetName().Name + ".filename.exe" > > Dim strm As System.IO.Stream = asm.GetManifestResourceStream(resourceName) > > Dim buffer() As Byte = New Byte(strm.Length) {} > > strm.Read(buffer, 0, CInt(buffer.Length)) > > strm.Close() > > Dim tempName As String = System.IO.Path.GetTempFileName() > > Dim fs As New System.IO.FileStream(tempName, System.IO.FileMode.Create) > > fs.Write(buffer, 0, CInt(buffer.Length)) > > fs.Close() > > > -- > ------------------ > Jesterware DVD Audio Ripper - The ultimate DVD to mp3/ogg/wav/aac Utility. > http://www.jesterware.co.uk > |
|||||||||||||||||||||||