Delphi iniFile 的问题
procedureTForm1.Button2Click(Sender:TObject);varIniFiles1,IniFiles2,IniFiles3:TIniFil...
procedure TForm1.Button2Click(Sender: TObject);
var
IniFiles1,IniFiles2,IniFiles3:TIniFile;
begin
if FileExists(PChar(MirPath+'map\0.map'))=True then
begin
if FileExists(PChar(MirPath+'MirClient.dat'))=True then
begin
IniFiles1:=TIniFile.Create(MirPath+'ftp.ini');
IniFiles1.EraseSection('Server');
IniFiles1.WriteString('Server','ServerCount','1');
IniFiles1.WriteString('Server','Server1caption',Label2.Caption);
IniFiles1.WriteString('Server','Server1name',Label2.Caption);
IniFiles2:=TIniFile.Create(MirPath+'mir.ini');
IniFiles2.EraseSection('setup');
IniFiles2.WriteString('setup','ServerAddr',Label4.caption);
IniFiles2.WriteString('setup','patched','0');
IniFiles2.WriteString('setup','ShowTopData','0');
IniFiles2.WriteString('setup','RunToHuman','1');
IniFiles2.WriteString('setup','ShowUserDurg','0');
IniFiles2.WriteString('setup','PlayMusic','1');
IniFiles3:=TIniFile.Create(MirPath+'mirsetup.ini');
IniFiles3.WriteString('setup','FontName','楷体');
IniFiles3.WriteString('setup','ServerAddr',Label4.Caption);
IniFiles1.Free;
IniFiles2.Free;
IniFiles3.Free;
showmessage(mirpath);
WinExec(pchar(MirPath+'MirClient.dat'),SW_SHOWNORMAL);//sw_normal);
{IniFiles1:=TIniFile.Create(Path+'ftp.ini');
IniFiles1.EraseSection('Server');
IniFiles1.WriteString('Server','ServerCount','1');
IniFiles1.WriteString('Server','Server1caption',Label2.Caption);
IniFiles1.WriteString('Server','Server1name',Label2.Caption);
IniFiles2:=TIniFile.Create(Path+'mir.ini');
IniFiles2.EraseSection('setup');
IniFiles2.WriteString('setup','ServerAddr',Label4.caption);
IniFiles2.WriteString('setup','patched','0');
IniFiles2.WriteString('setup','ShowTopData','0');
IniFiles2.WriteString('setup','RunToHuman','1');
IniFiles2.WriteString('setup','ShowUserDurg','0');
IniFiles2.WriteString('setup','PlayMusic','1');
IniFiles3:=TIniFile.Create(Path+'mirsetup.ini');
IniFiles3.WriteString('setup','FontName','楷体');
IniFiles3.WriteString('setup','ServerAddr',Label4.Caption);
IniFiles1.Free;
IniFiles2.Free;
IniFiles3.Free;
WinExec(pchar(MirPath+'MirClient.dat'),SW_SHOWNORMAL);//sw_normal);}
end
else
begin
MessageBox(Handle,'MirClient.dat文件不存在','Error',MB_OK);
end;
end
else
begin
MessageBox(handle,'传奇目录不正确,请手动设置【User.ini】中的Path路径!','Error',MB_OK);
Form1.Close;
end;
end;
path:=ExtractFilePath(Application.ExeName);
MirPath=D:\Program Files\游戏\热血传奇_兄弟\
第二段代码是把编译的Login.exe放到 MirPaht下去运行,程序启动游戏没有问题!
第一段代码 是放到其他文件夹运行,启动游戏就发现了问题,传奇弹出找不到 "Data\xxx.xxx" 的提示?
什么意思啊?
貌似是 WinExec的问题,Delphi还有其他函数来这样运行程序吗? 展开
var
IniFiles1,IniFiles2,IniFiles3:TIniFile;
begin
if FileExists(PChar(MirPath+'map\0.map'))=True then
begin
if FileExists(PChar(MirPath+'MirClient.dat'))=True then
begin
IniFiles1:=TIniFile.Create(MirPath+'ftp.ini');
IniFiles1.EraseSection('Server');
IniFiles1.WriteString('Server','ServerCount','1');
IniFiles1.WriteString('Server','Server1caption',Label2.Caption);
IniFiles1.WriteString('Server','Server1name',Label2.Caption);
IniFiles2:=TIniFile.Create(MirPath+'mir.ini');
IniFiles2.EraseSection('setup');
IniFiles2.WriteString('setup','ServerAddr',Label4.caption);
IniFiles2.WriteString('setup','patched','0');
IniFiles2.WriteString('setup','ShowTopData','0');
IniFiles2.WriteString('setup','RunToHuman','1');
IniFiles2.WriteString('setup','ShowUserDurg','0');
IniFiles2.WriteString('setup','PlayMusic','1');
IniFiles3:=TIniFile.Create(MirPath+'mirsetup.ini');
IniFiles3.WriteString('setup','FontName','楷体');
IniFiles3.WriteString('setup','ServerAddr',Label4.Caption);
IniFiles1.Free;
IniFiles2.Free;
IniFiles3.Free;
showmessage(mirpath);
WinExec(pchar(MirPath+'MirClient.dat'),SW_SHOWNORMAL);//sw_normal);
{IniFiles1:=TIniFile.Create(Path+'ftp.ini');
IniFiles1.EraseSection('Server');
IniFiles1.WriteString('Server','ServerCount','1');
IniFiles1.WriteString('Server','Server1caption',Label2.Caption);
IniFiles1.WriteString('Server','Server1name',Label2.Caption);
IniFiles2:=TIniFile.Create(Path+'mir.ini');
IniFiles2.EraseSection('setup');
IniFiles2.WriteString('setup','ServerAddr',Label4.caption);
IniFiles2.WriteString('setup','patched','0');
IniFiles2.WriteString('setup','ShowTopData','0');
IniFiles2.WriteString('setup','RunToHuman','1');
IniFiles2.WriteString('setup','ShowUserDurg','0');
IniFiles2.WriteString('setup','PlayMusic','1');
IniFiles3:=TIniFile.Create(Path+'mirsetup.ini');
IniFiles3.WriteString('setup','FontName','楷体');
IniFiles3.WriteString('setup','ServerAddr',Label4.Caption);
IniFiles1.Free;
IniFiles2.Free;
IniFiles3.Free;
WinExec(pchar(MirPath+'MirClient.dat'),SW_SHOWNORMAL);//sw_normal);}
end
else
begin
MessageBox(Handle,'MirClient.dat文件不存在','Error',MB_OK);
end;
end
else
begin
MessageBox(handle,'传奇目录不正确,请手动设置【User.ini】中的Path路径!','Error',MB_OK);
Form1.Close;
end;
end;
path:=ExtractFilePath(Application.ExeName);
MirPath=D:\Program Files\游戏\热血传奇_兄弟\
第二段代码是把编译的Login.exe放到 MirPaht下去运行,程序启动游戏没有问题!
第一段代码 是放到其他文件夹运行,启动游戏就发现了问题,传奇弹出找不到 "Data\xxx.xxx" 的提示?
什么意思啊?
貌似是 WinExec的问题,Delphi还有其他函数来这样运行程序吗? 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询