首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

delphi ShellExecute的用法解决办法

2013-01-04 
delphiShellExecute的用法ShellExecute(Application.Handle, nil, PChar(FileBatPath), nil, nil, SW_SHOW

delphi ShellExecute的用法

  ShellExecute(Application.Handle, nil, PChar(FileBatPath), nil, nil, SW_SHOWNORMAL);
 
  ShellExecute(Application.Handle, 'open', PChar(FileBatPath), nil, nil, SW_SHOWNORMAL);

 其中FileBatPath 是 .bat的目录。
 
  运行时 能打开.bat文件,窗体一闪而过!   但是不执行.bat里面的动作!!!

   如果我手动打开.bat文件 执行后会弹出成功/失败的窗口,  用ShellExecute后 没有弹出结果框。 

   并且能确定里面的动作没有执行。。。。这个啥原因?
[解决办法]
直接执行
ShellExecute(Application.Handle, 'open', PChar('winpop'), 'add 000001@youxiang.com /createuser 000001', nil, SW_SHOWNORMAL);
倒数第二个参数,写上执行的winpop的路径。
[解决办法]
用这个应该可行:

WinExec(PChar(FileBatPath), SW_HIDE);

刚找了下我自己的程序,就是用这个方式执行.BAT文件的,并有弹出提示

热点排行