菜鸟问题,哪高手闲来解答一下子(100分)

  • 主题发起人 主题发起人 gzin
  • 开始时间 开始时间
G

gzin

Unregistered / Unconfirmed
GUEST, unregistred user!
在一文件夹files下有好多.exe文件,例main.exe、a.exe、b.exe、c.exe、d.exe,其中main.exe是主程序,执行后里面有一菜单,选择任一项就会相应执行files文件夹下的.exe模块(如a.exe/b.exe/c.exe),当退出子模块后又会重新显示原来的main.exe的界面,这样的程序是怎么控制的,谁有类似的源码,能否拿来参考下啊。
 
procedure TForm1.ShellExec(AFileName: String);
var
sCommandLine: String;
bCreateProcess: boolean;
lpStartupInfo: TStartupInfo;
lpProcessInformation: TProcessInformation;
begin
Hide;
sCommandLine := AFileName;
if not FileExists(AFileName) then Exit;
FillChar(lpStartupInfo, Sizeof(TStartupInfo), #0);
lpStartupInfo.cb := Sizeof(TStartupInfo);
lpStartupInfo.dwFlags := STARTF_USESHOWWINDOW;
lpStartupInfo.wShowWindow := SW_NORMAL;
bCreateProcess := CreateProcess(nil, PChar(sCommandLine),nil, nil, True,
CREATE_NEW_CONSOLE or NORMAL_PRIORITY_CLASS, nil, nil, lpStartupInfo,
lpProcessInformation);
if bCreateProcess then //等外部进程的结束
WaitForSingleObject(lpProcessInformation.hProcess, INFINITE);
Show;
end;
 
winExec('a.exe', 1);
 
LZ的意思是否是将不同语言的程序编译成
EXE文件,然后集成在一个平台上?
 
winExec('a.exe', 1);
 
执行可以用WinExec,可以执行时把主窗口隐藏了,执行完后再Show
 
Delphi技术联盟群:23889386
 
多人接受答案了。
 
后退
顶部