Hey guys,
I asked a question yesterday and recieved an answer which was 100 % accurate and what i am after.
I need some more help.
Basically in my project i want to place a embedded file to program files\test\
The method i am using is this
[code]
public static void SaveResource(string resourceName, string fileName)
{
Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName);
using (FileStream fileStream = new FileStream(fileName, FileMode.Create))
{
byte[] b = new byte[stream.Length + 1];
stream.Read(b, 0, Convert.ToInt32(stream.Length));
fileStream.Write(b, 0, Convert.ToInt32(b.Length - 1));
fileStream.Flush();
fileStream.Close();
}
stream.Close();
}
[/code]
and after i have done the above i just add to w/e button i want to move the file with this:
[code]SaveResource("WindowsFormsApplication1.test.exe", @"C:\Program Files\test")[/code]
Now this all seems to work fine. I first try debug in C# and then open the exe as an admin and try it and i get an error saying thati dont have rights to move it? I think that is User Account Control preventing it from being allowed. Is their a way to make it possible of this to be allowed to be moved? I even tried my desktop and it wans't allowed ? UAC isnt even on medium settings here. Is something in the above incorrect?
I also added at the start Using System.IO and Using System.Reflection, The program is ran as admin, The test.exe is a embedded resource.