Windows 7上无效的过程调用或参数 [英] Invalid procedure call or argument on Windows 7

查看:160
本文介绍了Windows 7上无效的过程调用或参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个VB6 DLL,该文件由外部应用程序使用VBScript调用.叫做这样,

We have a VB6 DLL which is being called by external application using VBScript. It is called like this,

Set sa=CreateObject("Server.Area")
sa.Import(a)


多年来,它一直在WinXP上工作.现在我们移至Windows 7 Enterprise(x86),此DLL给出错误Invalid procedure call or argument.调试无济于事.如果我对其进行调试,它可以正常工作而不会出现任何错误.在事件查看器中找不到任何内容.


It has been working on WinXP since years. Now that we are moved to Windows 7 Enterprise(x86), this DLL gives error Invalid procedure call or argument. Debugging can''t help. If I debug it, it works fine without any error. Nothing is found in event viewer.

To summarize,
1. It is 32 bit system (Win7), there is no separate SYSWOW.
2. There is no error while debugging.
3. Error is being generated at random stage in process.
4. It was working fine for years in WinXP



可能是访问权限问题.我尝试了提升权限的应用程序,但没有成功.我什至在兼容模式下尝试了它,但是通过使应用程序挂起而使情况变得更糟.

有人可以指导我摆脱这一点吗?甚至是什么导致了此问题?

在此先感谢.



It could be access permission issue. I tried application with elevated rights with no success. I even tried it in compatibility mode, but it makes it worse by making calling application hang.

Can somebody guide me to get rid of this? Or even what is causing this issue?

Thanks in advance.

推荐答案

如果尝试使用后期绑定调用不存在的方法,VB6通常会引发此错误.确保使用regsvr32注册了DLL,并且存在Import方法.
VB6 usually throws this error if you try to call a non-existent method using late binding. Make sure your DLL is registered using regsvr32 and that the Import method exists.


有一个循环来处理n个对象.经过一番迭代之后,它被卡住了.我找不到确切的原因,但是尝试了一些随机的东西,找到了经典的解决方法-"Delay".

我用循环替换了ShowName o.Cases(i).Name,该循环带来了延迟,并一遍又一遍地尝试直到成功.您可能希望对重试次数进行限制,例如while attempts < 10.
There was a loop to process n nummber of objects. And there it was getting stuck after some iteration. I couldn''t find the exact reason, but tried out some random stuffs and found the classic work-around - "Delay".

I replaced ShowName o.Cases(i).Name with a loop which puts a delay and try it again and again until it succeeds. You may like to put the limit on number of retries in while like while attempts < 10.
Do
  If Err.Number <> 0 Then DoEvents : Sleep 2000 : DoEvents : Err.Clear
  ShowName o.Cases(i).Name
Loop While Err.Number <> 0



PS:Sleep是API调用



PS: Sleep is an API call

Private Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)


这篇关于Windows 7上无效的过程调用或参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆