Форум · Полнота восстановления · Каталог вариантов

[SHARE] AutoUpdater for private servers — kazhkaz — #22885

Сообщение в форуме

Снимок 2006-06-03 02:46 UTC

Имя в снимке: kazhkaz · Источник Wayback

imaznumkay wrote:

relative path doesnt work o_O

..\system\l2.exe      ../system/l2.exe

same error

im lovin the update feature tho Very Happy

Here, replace the TMain.Button2Click(Sender: TObject) method with this - it will definitely work Smile

procedure TMain.Button2Click(Sender: TObject);

var s, s1: string;

    pc, pc1: PChar;

    r: integer;

begin

  // launch lineage2

  s:= ExtractFilePath(ParamStr(0))+'System\l2.exe';

  s1:= ExtractFilePath(s);

  pc:= AllocMem(Length(s)+1);

  pc1:= AllocMem(Length(s1)+1);

  StrPCopy(pc, s);

  StrPCopy(pc1, s1);

  chDir(s1);

  r:= ShellExecute(Handle, 'Open', pc, '', pc1, SW_SHOWNORMAL);

  FreeMem(pc);

  FreeMem(pc1);

  case r of

    0: begin

      MessageBox(Handle, 'System is out of resources',

                 'Out of resources', MB_OK+MB_ICONERROR);

    end;

    ERROR_FILE_NOT_FOUND: begin

      MessageBox(Handle, 'Lineage II main executable not found.'#13#10+

                         'Check whether the launcher is in Lineage II installation root directory.'#13#10+

                         'Also, you may have not updated your Lineage II yet.',

                 'File Not Found', MB_OK+MB_ICONERROR);

    end;

    ERROR_PATH_NOT_FOUND: begin

      MessageBox(Handle, 'Lineage II main executable path not found.'#13#10+

                         'Check whether the launcher is in Lineage II installation root directory.'#13#10+

                         'Also, you may have not updated your Lineage II yet.',

                 'Path Not Found', MB_OK+MB_ICONERROR);

    end;

    else begin

      if r > 33 then Close

      else begin

        MessageBox(Handle, 'Unknown error has occurred while launching Lineage II'#13#10+

                           'Check whether the launcher is in Lineage II installation root directory.'#13#10+

                           'Also, you may have not updated your Lineage II yet.',

                   'Unknown Error', MB_OK+MB_ICONERROR);

      end;

    end;

  end;

end;