Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


C#/Java: Changing Launched JAR Icon


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
No replies to this topic

#1 Drakken255   Members   -  Reputation: 173

Like
0Likes
Like

Posted 10 September 2012 - 09:18 AM

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, 10 September 2012 - 09:21 AM.


Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS