View Single Post
Old 10.11.2005, 16:31   #13
kazhkaz
Архивный участник
 
Join Date: Oct 2005
Posts: 55
Default

Quote:
Originally Posted by imaznumkay
relative path doesnt work o_O

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

same error

im lovin the update feature tho
Here, replace the TMain.Button2Click(Sender: TObject) method with this - it will definitely work
Code:
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;
kazhkaz is offline