Jump to content
  • Advertisement
Sign in to follow this  
Drakken255

C#/Java: Changing Launched JAR Icon

This topic is 2229 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello all, I am starting development of 2.0 of my program, PatchCraft. (go.to/patchcraft) I have been able to launch Minecraft directly without using the launcher, but cannot change the icon from the current Java logo. I am currently using this:

//Class level:
[DllImport("user32.dll")]
public static extern int SendMessage(IntPtr hwnd, int message, int wParam, IntPtr lParam);
private const int WM_SETICON = 0x80;
private const int ICON_SMALL = 0;
private const int ICON_BIG = 1;
//Method level:
string appData = Environment.GetEnvironmentVariable("APPDATA");


ProcessStartInfo mcStartInfo = new ProcessStartInfo("javaw", "-Xms1G -Xmx1G -cp \"" + appData + "\\.minecraft\\bin\\minecraft.jar;" + appData + "\\.minecraft\\bin\\jinput.jar;" + appData + "\\.minecraft\\bin\\lwjgl.jar;" + appData + "\\.minecraft\\bin\\lwjgl_util.jar;\" -Djava.library.path=\"" + appData + "\\.minecraft\\bin\\natives\" net.minecraft.client.Minecraft" + " " + username + " " + sessionID);
Process minecraft = new Process() { StartInfo = mcStartInfo };

minecraft.Start();
minecraft.WaitForInputIdle();

SendMessage(minecraft.MainWindowHandle, WM_SETICON, ICON_BIG, Icon.FromHandle(this.Handle).Handle);

//Also tried:
//SendMessage(minecraft.MainWindowHandle, WM_SETICON, ICON_SMALL, Icon.FromHandle(this.Handle).Handle);


On a side note, why can't I start it from my program with more than one gigabyte of memory, when my computer is capable of running a legit server and client with 8GB each at the same time? Edited by Drakken255

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!