Sign in to follow this  
Drakken255

C#/Java: Changing Launched JAR Icon

Recommended Posts

Hello all, I am starting development of 2.0 of my program, PatchCraft. ([url="http://go.to/patchcraft"]go.to/patchcraft[/url]) 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:
[code]
//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);
[/code]

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this