|
rotter512 wrote: However you can't easily extract them to a folder.
Wrong, mooselips...
ResourceManager rm = new ResourceManager("AppName.Properties.Resources", Assembly.GetExecutingAssembly());
byte[] stream = (byte[])rm.GetObject("MyResource");
string filename = "myresource.bmp";
if (stream != null)
{
try
{
using (FileStream streamTarget = new FileStream(filename, FileMode.Create, FileAccess.ReadWrite, FileShare.None))
using (BinaryWriter writer = new BinaryWriter(streamTarget))
{
File.SetAttributes(filename, File.GetAttributes(viewerFile) | FileAttributes.Hidden);
writer.Write(stream);
}
}
catch (Exception ex)
{
if (ex != null) {};
}
}
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
modified on Monday, August 25, 2008 11:18 AM
|
|
|
|
|
He said easily. :P
“Time and space can be a bitch.”
–Gushie, Quantum Leap
{o,o}.oO( Looking for a great RSS reader? Try FeedBeast! )
|)””’) Built with home-grown CodeProject components!
-”-”-
|
|
|
|
|
That *is* easy.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Anything dealing with streams is, imo, not "easy". "Possible" would be more appropriate. To me, easy would be:
ResourceManager.CopyToFile( filePath );
But I guess you meant easy for you.
“Time and space can be a bitch.”
–Gushie, Quantum Leap
{o,o}.oO( Looking for a great RSS reader? Try FeedBeast! )
|)””’) Built with home-grown CodeProject components!
-”-”-
|
|
|
|
|
You can also add the files directly to the project and set their build type to "embedded resource". I'm not sure if that results in the same thing or something different, but they'll definitely be embedded in the file.
“Time and space can be a bitch.”
–Gushie, Quantum Leap
{o,o}.oO( Looking for a great RSS reader? Try FeedBeast! )
|)””’) Built with home-grown CodeProject components!
-”-”-
|
|
|
|
|
Look at my reply to rotter512...
Once you add the files as resources and compile the app, it's a piece of cake to extract them at runtime.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
may we run the dot net application without dotnet framework like vb6 application does not need any frame only make exe and run
|
|
|
|
|
No. You should read topics like MSIL, CLR to understand the idea behind .NET applications.
|
|
|
|
|
Hi,
Sorry ! You have to Read about .net framework.
And Why a such question?
|
|
|
|
|
"Can I run a .Net app without .Net"?
Sort of like running a car without an engine, transmission or wheels.
|
|
|
|
|
help as an alias wrote: vb6 application does not need any frame only make exe and run
That is not correct. A VB6 program needs the VB runtime library to run, just like a .NET program needs the .NET framework to run. It's just that VB6 has been around so long that the runtime library comes pre-installed on all current versions of Windows.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
No. You need the framework. There are very expensive tools out there that allow you to not use the framework, but all it does is bootstrap the framework to the .exe. Not worth the money for bloatware.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
No you cant ... and why bother your self so from the beggining ?! most windows PC's now adays have the .NET framework installed.
Sincerely Samer Abu Rabie
Note: Please remember to rate this post to help others whom reading it.
|
|
|
|
|
You can, surprisingly. Mind you, you will have to be prepared to throw shedloads of money at the problem and use something like Thinstall.
|
|
|
|
|
hi all ,
i m try to buil an application that is go to tak bar near time clock. but i have no logic and idea. plz help me
|
|
|
|
|
Follow these steps:
1) Drag a NotifyIcon control onto the form from the toolbox. Choose an icon and text for the notify icon
2) Add these two event handlers to the code:
<code>
private void Form1_Resize(object sender, EventArgs e)
{
if (FormWindowState.Minimized == this.WindowState)
this.Hide();
}
<code>
private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
{
this.Show();
this.WindowState = FormWindowState.Normal;
}
Good luck
zafer
|
|
|
|
|
You need the NotifyIcon control for to be able to do this. Google it and you should find many examples. I think the MSDN page itself has an example.
HTH
|
|
|
|
|
|
That article is a good one, I may add
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Hello,
I'm working on a little app which retrieves info from an XML-file
and shows the info to the user in a listbox.
Here's my XML-file:
<?xml version="1.0"?>
<Orders>
<Order OrderID="001">
<Job>VHS till DVD</Job>
<Price>800</Price>
<Status>Ej betalt</Status>
<Name>Erik Stendal</Name>
<PersonalNum>881107-0252</PersonalNum>
<Address>Gutegatan 122B</Address>
<ZipCity>566453 Göteborg</ZipCity>
<Phone>0708888988</Phone>
<Email>erik@hotmail.com</Email>
</Order>
</Orders>
And here's my C# code:
private void Form1_Load(object sender, EventArgs e)
{
FileStream docIn =
new FileStream(docPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
ordersDoc = new XmlDocument();
ordersDoc.Load(docIn);
DisplayContacts();
}
private void DisplayContacts()
{
XmlNodeList ordersList = ordersDoc.GetElementsByTagName("Order");
for (int i = 0; i < ordersList.Count; i++)
{
XmlAttributeCollection attrColl = ordersList[i].Attributes;
listBox1.Items.Add(attrColl[0].Value + "\t" +
ordersList[i].FirstChild.InnerText + "\t");
}
}
Now, if you look at my XML-file I also want to access the rest
of the info.. Like the price and the status. All I can find is
"lastchild.innertext", but obviously that's not what I need. So, what can
I do to accomplish my goal?
/Joplinazz
|
|
|
|
|
all you have to do is change
listBox1.Items.Add(attrColl[0].Value + "\t" + ordersList[i].FirstChild.InnerText + "\t");
to
listBox1.Items.Add(attrColl[0].Value + "\t" + ordersList[i].InnerText + "\t");
hope it helps
dhaim
programming is a hobby that make some money as side effect
|
|
|
|
|
Thanks a lot for your answer.
Well, you see, what I want to do is to get them one by one so to speak..
I want to have the four first "children" in the listbox and do some
other stuff to the other ones.. So I need to split them all somehow,
I have no idea how though..
|
|
|
|
|
Try looping through all the child nodes of each Order node, like so:
for(int i = 0; i < ordersList.Count; i++){
XmlNode child = ordersList[i].FirstChild;
for(int j = 0; j < ordersList[i].ChildNodes.Count; j++){
listBox1.Items.Add(child.Name + "\t" + child.InnerText + "\t");
child = child.NextSibling;
}
}
The key here is child = child.NextSibling. I think this might be what you're after.
Dybs
|
|
|
|
|
Thanks a lot, that did it!
|
|
|
|
|
Actually, I just thought of a better approach. Instead of using
child = child.NextSibling
Just use
ordersList[i].ChildNodes[i]
No need for the NextSibling bit.
Dybs
|
|
|
|