[CODE]How To Make A Quick Launcher In Delphi!

Experienced Elementalist
Joined
Jun 30, 2008
Messages
256
Reaction score
1
I was just browsing the forums, and thought "Why not post a small guide?" :p

This is for people who's got Delphi! (Its not free, so don't ask me for a download link!)

Alright, boot up Delphi.

File>New>VCL Forms Application

Aight, you got your form! Now, add a button to it!

Tool Palette (On the left)>Standard>TButton

Okay, you got your start button! Change the caption to something else than Button1 :p


Alright, double-click the button, which brings you to the code view. Scroll AAAALL the way up, untill you see something like;

Code:
[COLOR="Purple"][B]uses[/B][/COLOR]
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs;

Add "ShellAPI" there, so it will look like

Code:
[COLOR="Purple"][B]uses[/B][/COLOR]
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, [COLOR="Red"]ShellAPI[/COLOR];

Alright, now for the Start-Button code!

Scroll down to the Button1 code, and between the Begin and End; tags, add the following:

Code:
ShellExecute(Handle,[COLOR="DeepSkyBlue"]'Open'[/COLOR],PChar(GetCurrentDir+[COLOR="DeepSkyBlue"]'\Neuz.exe'[/COLOR]),[COLOR="DeepSkyBlue"]'Sunkist'[/COLOR],nil,SW_SHOW);

That code opens the Neuz.exe in the directory where your newly created application is stored, with the parameter Sunkist. So now, all you gotta do, is place the .exe in your Flyff directory, and BAM! You're done! :D

This is the whole Button1 code:

Code:
[B][COLOR="Purple"]procedure[/COLOR][/B] TForm1.Button1Click(Sender: TObject);
begin
ShellExecute(Handle,[COLOR="DeepSkyBlue"]'Open'[/COLOR],PChar(GetCurrentDir+[COLOR="DeepSkyBlue"]'\Neuz.exe'[/COLOR]),[COLOR="DeepSkyBlue"]'Sunkist'[/COLOR],nil,SW_SHOW);
end;

Thats it! :D

Now, you can customize your new launcher with a background image, and whatever you want :D

If you want an image instead of the button, just do the same with the image! Double Click it, add ShellAPI to the Uses clause, and add the ShellExecute code to the Image's OnClick event! (Same as with the button).

~ Jeff
 
Back
Top