VB“Automation 错误” 或 “无法定位程序输入点 DoOpenPipeStream 于动态链接库ScrRun.dll上”

说明“Automation 错误”其实是VB调用程序或组件时,程序或组件返回的错误,因此需要考虑这些组件是否能正确运行

如在某些机器上运行以下代码时:

会产生“AutoMation 错误”,原因是"Wscript.Shell"无法正常运行

-------------------------------------------------------------------------------------------------------------------------

以下方法转自网络,已经成功地解决问题!

错误消息和前面的一样“WSript.exe - 无法找到入口 ”,无法创建名为“Wscript.Shell”的对象。于是开始了疯狂百度,原因是说要么脚本被禁用(不可能,因为弹出消息来了嘛),二是文件被改动。网上一般是说注册两个组件就OK了,如下:

regsvr32 srcrun.dll (命令成功)
regsvr32 wshom.ocx (弹出错误提示:无法定位程序输入点 DoOpenPipestream 于动态链接库ScrRun.dll上)一个执行成功,后一个怎么弄都是错误,消息是“LoadLibary("wshom")失败,找不到指定的程序”,看了看system32目录下,wshom.ocx是有的。后来开始认识到可能是wshom.ocx被破坏了,于是找了相同版本的电脑(我的是XP SP3),然后写段脚本,把下面的文件拷出来:mkdir c:/repairset source=%windir%/system32set target=c:/repaircopy %source%/cscript.exe %target%copy %source%/jscript.dll %target%copy %source%/scrobj.dll %target%copy %source%/scrrun.dll %target%copy %source%/vbscript.dll %target%copy %source%/wscript.exe %target%copy %source%/wshext.dll %target%copy %source%/wshom.ocx %target%pause并将对方机器上的c:/repair目录拷贝到我的c:/下,然后用下列脚本更新:set source=c:/repairset target=%windir%/system32copy %source%/cscript.exe %target%copy %source%/jscript.dll %target%copy %source%/scrobj.dll %target%copy %source%/scrrun.dll %target%copy %source%/vbscript.dll %target%copy %source%/wscript.exe %target%copy %source%/wshext.dll %target%copy %source%/wshom.ocx %target%regsvr32 %target%/jscript.dllregsvr32 %target%/scrobj.dllregsvr32 %target%/scrrun.dllregsvr32 %target%/vbscript.dllregsvr32 %target%/wshext.dllregsvr32 %target%/wshom.ocxpause完成后使用脚本测试CreateObject("WScript.Shell")成功,

相关文章

Format[$] ( expr [ , fmt ] ) format 返回变体型 format$ 强...
VB6或者ASP 格式化时间为 MM/dd/yyyy 格式,竟然没有好的办...
在项目中添加如下代码:新建窗口来显示异常信息。 Namespace...
转了这一篇文章,原来一直想用C#做k3的插件开发,vb没有C#用...
Sub 分列() ‘以空格为分隔符,连续空格只算1个。对所选...
  窗体代码 1 Private Sub Text1_OLEDragDrop(Data As Dat...