matto Posted April 18, 2009 Posted April 18, 2009 Hi, I have some code which copies 2 files to a folder. These 2 files are included in the current application folder. Is it possible to embed these 2 files into the .exe and copy them to a destination folder? Here's my code so far: Dim CurrentLocationDll As String = Application.StartupPath & "\FILE.dll" Dim DestinationFolder As String = System.Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) & "\FOLDER" If (FileIO.FileSystem.FileExists(CurrentLocationDll)) Then ProgressBar1.PerformStep() If (FileIO.FileSystem.FileExists(DestinationFolder & "\FILE.dll")) Then FileIO.FileSystem.MoveFile(DestinationFolder & "\FILE.dll", DestinationFolder & "\FILE.dll.bak") ProgressBar1.PerformStep() End If FileIO.FileSystem.CopyFile(CurrentLocationDll, DestinationFolder & "\FILE.dll") ProgressBar1.PerformStep() End If Quote
Administrators PlausiblyDamp Posted April 18, 2009 Administrators Posted April 18, 2009 http://www.xtremedotnettalk.com/showthread.php?t=83574 might be enough to get you started. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
matto Posted April 18, 2009 Author Posted April 18, 2009 Thanks, but that's for txt and gif files :S Quote
Administrators PlausiblyDamp Posted April 18, 2009 Administrators Posted April 18, 2009 Did you try it with a dll though? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
matto Posted April 18, 2009 Author Posted April 18, 2009 I looked through the guides, didn't need it in the end xD Managed to find an example with a .dll and it worked for me. Thanks for helping Quote
Administrators PlausiblyDamp Posted April 19, 2009 Administrators Posted April 19, 2009 One thing to be careful with though is the fact than on XP or later only administrators will have permissions to write to the Program Files folder (I'm assuming that is where your application is being installed) so for non-admins this technique might not work. On Vista or later there is a good chance the end user will be annoyed by UAC prompts even if they are admins every time they run this app. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.