PHP Forum - Coding Board
Juni 18, 2018, 02:29:22 *
Willkommen Gast. Bitte einloggen oder registrieren.

Einloggen mit Benutzername, Passwort und Sitzungslänge
News:
 
   Übersicht   Hilfe Suche Einloggen Registrieren  
Seiten: [1]
  Drucken  
Autor Thema: WoW Launcher Source (coded by myself)  (Gelesen 216 mal)
0 Mitglieder und 1 Gast betrachten dieses Thema.
clown
Newbie
*
Beiträge: 11

935663
Profil anzeigen E-Mail
« am: September 26, 2008, 06:41:11 »

Ja, ich hab vor kurzer Zeit mal einen WoW Launcher gecodet. Der Sourcecode ist relativ einfach aber vielleicht kann ja irgendjemand etwas damit anfangen:

Code:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls, StdCtrls, IniFiles, ActnList, ExtCtrls, ShellApi, GIFImg,
  jpeg;

type
  TfrmLauncher = class(TForm)
    ListView: TListView;
    imgBackground: TImage;
    imgClose: TImage;
    imgAdd: TImage;
    imgDelete: TImage;
    imgSettings: TImage;
    imgStart: TImage;
    lblCopyright: TLabel;
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure imgBackgroundMouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure imgCloseClick(Sender: TObject);
    procedure imgAddClick(Sender: TObject);
    procedure imgDeleteClick(Sender: TObject);
    procedure imgSettingsClick(Sender: TObject);
    procedure imgStartClick(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  frmLauncher: TfrmLauncher;
  realmlist : TextFile;
  ini, ini2: TIniFile;
  Sections : TStringList;

implementation

uses Unit2, Unit3;

{$R *.dfm}

procedure TfrmLauncher.FormCreate(Sender: TObject);
var
  i : Integer;
begin
Sections := TStringList.Create;
ini := TIniFile.Create(ExtractFilePath(ParamStr(0)) + 'realmlist.ini');
ini2 := TIniFile.Create(ExtractFilePath(ParamStr(0)) + 'settings.ini');

try
  ini.ReadSections(Sections);
  for i := 0 to Sections.Count-1 do
    with ListView.Items.Add do
    begin
      Caption := Sections[i];
      SubItems.Add(ini.ReadString(Sections[i], 'IP', ''));
    end;
finally
  Sections.Free;
end;

AlphaBlendValue := ini2.ReadInteger('Window', 'opacity', 255);
end;

procedure TfrmLauncher.FormDestroy(Sender: TObject);
begin
ini.Free;
end;

procedure TfrmLauncher.imgBackgroundMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
 ReleaseCapture;
 Perform(WM_SYSCOMMAND, $F012, 0);
end;

procedure TfrmLauncher.imgCloseClick(Sender: TObject);
begin
  Close;
end;

procedure TfrmLauncher.imgAddClick(Sender: TObject);
begin
if not Assigned(frmAddServer) then
  Application.CreateForm(TfrmAddServer, frmAddServer);
frmAddServer.Show;
end;

procedure TfrmLauncher.imgDeleteClick(Sender: TObject);
begin
if ListView.ItemIndex <> -1 then
begin
  ini.EraseSection(ListView.Items[ListView.ItemIndex].Caption);
  ListView.DeleteSelected;
end
else
  Application.MessageBox('Choose a server you want to delete!', 'WoW Launcher Error', MB_OK + MB_IconExclamation);
end;

procedure TfrmLauncher.imgSettingsClick(Sender: TObject);
begin
if not Assigned(frmOptions) then
  Application.CreateForm(TfrmOptions, frmOptions);
frmOptions.Show;
end;

procedure TfrmLauncher.imgStartClick(Sender: TObject);
begin
if ListView.ItemIndex <> -1 then
begin
  AssignFile(realmlist, Copy(ini2.ReadString('Settings', 'wowpath', ''), 0, pos('WoW.exe', ini2.ReadString('Settings', 'wowpath', '')) -1) + 'realmlist.wtf');
  ReWrite(realmlist);
  WriteLn(realmlist, 'set realmlist ' + ListView.Items.Item[ListView.ItemIndex].SubItems.Strings[0]);
  CloseFile(realmlist);
  ShellExecute(Handle, 'open', PChar(ini2.ReadString('Settings', 'wowpath', '')), nil, nil, SW_Normal);
  if ini2.ReadInteger('Settings', 'closelauncher', 0) = -1 then
    Close;
end
else
   Application.MessageBox('Choose a server to connect with!', 'WoW Launcher Error', MB_OK + MB_IconExclamation);
end;

end.
Gespeichert
Seiten: [1]
  Drucken  
 
Gehe zu:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2006-2009, Simple Machines | New Look by Nolt Prüfe XHTML 1.0 Prüfe CSS