请问,在我的应用程序中,怎么样来启动另外的一个应用程序,我已经知道用
ShellExecute(handle,'open','c:\myapp\myapp.exe','-s','',SW_SHOWNORMAL);但是,我想在程序中动态指定应用程序的路径,而不是死的路径。如:'c:\myapp\myapp.exe',太死了

解决方案 »

  1.   

    VAr 
        LuJing  : String ;    LUJing := Extractfiledir(Application.exeName ); 
        LuJing := LuJing +'\1.exe';     ShellExecute(handle,'open',Pchar(Lujing),'-s','',SW_SHOWNORMAL);
      

  2.   

    关键是变量我还不会设啊,是怎么设呢,我现在是想用getcurrentdir来取得一个当前目录,但是怎么样加到ShellExecute命令中啊。
      

  3.   

    系统运行目录Application.filename获得
      

  4.   

    VAr 
        LuJing  : String ;    LUJing := getcurrentdir(); 
        LuJing := LuJing +'\1.exe';     ShellExecute(handle,'open',Pchar(Lujing),'-s','',SW_SHOWNORMAL);偶不知所云了,替换你总该会吧。
      

  5.   

    shellexecute(application.Handle,'open','http://www.getchar.com', '', '',sw_show);
      

  6.   

    var
        PathStr: String ;    PathStr := GetCurrentDir(); 
        PathStr := PathStr +'\1.exe';     ShellExecute(handle,'open',Pchar(PathStr ),'-s','',SW_SHOWNORMAL);
      

  7.   

    用winexec也可以呀,这里多向你提供一种方法。希望对你有所帮助