一个关于WinExec的小小小问题?

tgtt 2003-03-16 03:12:17
每次调用WinExec后,都是弹出另外一个窗口并打开应用程序。
请问可不可以这样:
将要调用的程序的运行窗口限制在调用它的表单之内?就好象是表单的一个控件似的?
...全文
28 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
softboysxp 2003-03-30
  • 打赏
  • 举报
回复
用SetParent
jun_01 2003-03-23
  • 打赏
  • 举报
回复
类似于屏保设置界面吧,关注!
cslegend 2003-03-22
  • 打赏
  • 举报
回复
用CreateProcess控制:
function TFrmCustShot.WinExecAndWait32(FileName:String; Visibility : integer):dword;
var
zAppName:array[0..512] of char;
zCurDir:array[0..255] of char;
WorkDir:String;
StartupInfo:TStartupInfo;
ProcessInfo:TProcessInformation;
begin
Result := 0; { pointer to PROCESS_INF }
StrPCopy(zAppName,FileName);
GetDir(0,WorkDir);
StrPCopy(zCurDir,WorkDir);

FillChar(StartupInfo,Sizeof(StartupInfo),#0);
StartupInfo.cb := Sizeof(StartupInfo);
StartupInfo.dwFlags := STARTF_USESHOWWINDOW;
StartupInfo.wShowWindow := Visibility; //sw_show
if not CreateProcess( nil,
zAppName, { pointer to command line string }
nil, { pointer to process security attributes }
nil, { pointer to thread security attributes }
false, { handle inheritance flag }
CREATE_NEW_CONSOLE or { creation flags }
NORMAL_PRIORITY_CLASS,
nil, { pointer to new environment block }
nil, { pointer to current directory name }
StartupInfo, { pointer to STARTUPINFO }
ProcessInfo) then
begin
Application.MessageBox('无法启动要运行的软件',
'警告!',Mb_Ok or MB_ICONWARNING);
exit;
end
else
begin
WaitforSingleObject(ProcessInfo.hProcess,INFINITE);
GetExitCodeProcess(ProcessInfo.hProcess,Result);
end;
Result := 1; { pointer to PROCESS_INF }
end;
ekin 2003-03-21
  • 打赏
  • 举报
回复
用ole
tgtt 2003-03-21
  • 打赏
  • 举报
回复
up
divers 2003-03-16
  • 打赏
  • 举报
回复
关注!!

1,184

社区成员

发帖
与我相关
我的任务
社区描述
Delphi Windows SDK/API
社区管理员
  • Windows SDK/API社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧