2 Replies - 465 Views - Last Post: 15 June 2011 - 06:56 PM Rate Topic: -----

#1 EpicTTR  Icon User is offline

  • New D.I.C Head

Reputation: -3
  • View blog
  • Posts: 20
  • Joined: 15-June 11

How do I set an icon for a program using C#?

Posted 15 June 2011 - 04:41 PM

So I've built a program in Visual C# .NET that takes in a program, encrypts the bytes of the program, attaches a stub that can then decrypt the bytes, and execute the bytes at run time.

So how do I take this encrypted program with a stub, and set an icon for it?

I've tried something like:
                string S = "/unsafe /target:winexe";
                if (textBox2.Text != string.Empty) { S += " /win32icon:" + textBox2.Text; }



textBox2 is the file path of the icon file.

I then compile it using:

CompilerResults r = new CSharpCodeProvider(
                    new Dictionary<string, string>() { { "CompilerVersion", "v3.5" } }).CompileAssemblyFromSource(p, s);


s is the source file, and p is based on the user's settings.

So, why isn't it working?

Is This A Good Question/Topic? 0
  • +

Replies To: How do I set an icon for a program using C#?

#2 Sergio Tapia  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1253
  • View blog
  • Posts: 4,168
  • Joined: 27-January 10

Re: How do I set an icon for a program using C#?

Posted 15 June 2011 - 05:07 PM

How is it not working as you expect it to? What happens vs. what you want to happen?
Was This Post Helpful? 0
  • +
  • -

#3 EpicTTR  Icon User is offline

  • New D.I.C Head

Reputation: -3
  • View blog
  • Posts: 20
  • Joined: 15-June 11

Re: How do I set an icon for a program using C#?

Posted 15 June 2011 - 06:56 PM

View PostSergio Tapia, on 15 June 2011 - 05:07 PM, said:

How is it not working as you expect it to? What happens vs. what you want to happen?


Well it works fine until I run it, and press the button that executes the code I provided you with. At that point, my program just comes up with an error and closes. No problems in the debugger though.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1