C#/Java: Changing Launched JAR Icon

Started by
-1 comments, last by Drakken255 11 years, 7 months ago
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?

This topic is closed to new replies.

Advertisement