VB5 Long&双向VB.NET [英] VB5 Long & Double to VB.NET

查看:64
本文介绍了VB5 Long&双向VB.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些旧的VB5函数,指定Long和Double的类型,

调用非托管第三方DLL可能就像旧的一样。 DLL的来源

不可用。


我收到一些警告PInvoke..unbalanced stack ...在这上面读了一下

,并试图理解这个特殊的警告,我发现问题的一部分可能是因为 b分配空间的不匹配br />
变量,例如VB5 Long与VB2005 Long不一样。


另一部分是与CallingConvention有关,为此我不是全部

太确定如何设置它。


我是否理解了这个警告,是否有可能做的事情

纠正问题?我将补充说我正在将Access 2K3 VBA

应用程序转换为VB.NET 2005.在Access应用程序中一切正常。


问候

I have some old VB5 functions that specify types of Long and Double that
make calls to an unmanaged 3rd party DLL probably just as old. The source
for the DLL is not available.

I''m getting some warnings "PInvoke..unbalanced stack..." etc. Reading up a
bit on this and trying to understand this particular warning, I find that
part of the problem could be in the mismatch of allocated space for the
variables, e.g. VB5 Long is not the same as VB2005 Long.

Another part is to do with the CallingConvention and for this I''m not all
too sure how to set this up.

Have I understood this warning and is there something that may be done to
correct the problem? I will add that I am converting an Access 2K3 VBA
application to VB.NET 2005. In the Access app all worked OK.

Regards

推荐答案



Terry写道:

Terry wrote:

I有一些旧的VB5函数指定Long和Double的类型

调用非托管第三方DLL可能就像旧的一样。 DLL的来源

不可用。


我收到一些警告PInvoke..unbalanced stack ...在这上面读了一下

,并试图理解这个特殊的警告,我发现问题的一部分可能是因为 b分配空间的不匹配br />
变量,例如VB5 Long与VB2005 Long不一样。


另一部分是与CallingConvention有关,为此我不是全部

太确定如何设置它。


我是否理解了这个警告,是否有可能做的事情

纠正问题?我将补充说我正在将Access 2K3 VBA

应用程序转换为VB.NET 2005.在Access应用程序中一切正常。


问候
I have some old VB5 functions that specify types of Long and Double that
make calls to an unmanaged 3rd party DLL probably just as old. The source
for the DLL is not available.

I''m getting some warnings "PInvoke..unbalanced stack..." etc. Reading up a
bit on this and trying to understand this particular warning, I find that
part of the problem could be in the mismatch of allocated space for the
variables, e.g. VB5 Long is not the same as VB2005 Long.

Another part is to do with the CallingConvention and for this I''m not all
too sure how to set this up.

Have I understood this warning and is there something that may be done to
correct the problem? I will add that I am converting an Access 2K3 VBA
application to VB.NET 2005. In the Access app all worked OK.

Regards



特里 - 问题很可能是数据大小。直到.NET,你

除了stdcall函数和声明语句之外无法调用任何东西

(没有黑客)。 VB.NET会让你调用cdecl,但是stdcall是

的默认值。


在VB5 / 6中,Long是32位。在VB.NET中它是64位。您需要将
更改为Integer(VB.NET中为32位)。如果你的数据类型是

正确的大小并没有解决问题 - 那么你可能想要发布

函数声明(旧的和新的)。


-

汤姆谢尔顿

Terry - the problem is most likely data size. Up until .NET, you
couldn''t call anything but stdcall functions with declare statements
(without hacks). VB.NET will let you call cdecl, but stdcall is the
default.

In VB5/6 a Long was 32-bit. In VB.NET it is 64-bit. You need to
change it to Integer (32-bit in VB.NET). If making your datatypes the
right size doesn''t fix the issue - then you might want to post the
function declarations (old and new).

--
Tom Shelton


嗨汤姆,


感谢您的信息。我会先将Long'转换为int32以查看是否

修复警告。如果没有,我会发布声明。


问候


特里


" ;汤姆谢尔顿 < to ********* @ comcast.netwrote in message

news:11 ********************* @ v45g2000cwv.googlegro ups.com ...
Hi Tom,

Thanks for the info. I''ll convert the Long''s to int32 first to see if it
fixes the warnings. Failing that I''ll post the the declarations.

Regards

Terry

"Tom Shelton" <to*********@comcast.netwrote in message
news:11*********************@v45g2000cwv.googlegro ups.com...

>

Terry写道:
>
Terry wrote:

>我有一些旧的VB5函数,它们指定了Long和Double的类型,这些函数可能会调用非托管第三方DLL。 DLL的来源
不可用。

我收到一些警告PInvoke..unbalanced stack ...等等。阅读了这一点并尝试理解这个特殊警告,我发现问题的一部分可能是分配空间不匹配的
变量,例如VB5 Long与VB2005 Long不一样。

另一部分是与CallingConvention有关,为此我不是
所有
太确定如何设置它。

我是否理解了此警告,是否可以采取措施来解决问题?我将补充说我正在将Access 2K3 VBA
应用程序转换为VB.NET 2005.在Access应用程序中,一切正常。

问候
>I have some old VB5 functions that specify types of Long and Double that
make calls to an unmanaged 3rd party DLL probably just as old. The source
for the DLL is not available.

I''m getting some warnings "PInvoke..unbalanced stack..." etc. Reading up
a
bit on this and trying to understand this particular warning, I find that
part of the problem could be in the mismatch of allocated space for the
variables, e.g. VB5 Long is not the same as VB2005 Long.

Another part is to do with the CallingConvention and for this I''m not
all
too sure how to set this up.

Have I understood this warning and is there something that may be done to
correct the problem? I will add that I am converting an Access 2K3 VBA
application to VB.NET 2005. In the Access app all worked OK.

Regards



特里 - 问题很可能是数据大小。直到.NET,你

除了stdcall函数和声明语句之外无法调用任何东西

(没有黑客)。 VB.NET会让你调用cdecl,但是stdcall是

的默认值。


在VB5 / 6中,Long是32位。在VB.NET中它是64位。您需要将
更改为Integer(VB.NET中为32位)。如果你的数据类型是

正确的大小并没有解决问题 - 那么你可能想要发布

函数声明(旧的和新的)。


-

Tom Shelton


Terry - the problem is most likely data size. Up until .NET, you
couldn''t call anything but stdcall functions with declare statements
(without hacks). VB.NET will let you call cdecl, but stdcall is the
default.

In VB5/6 a Long was 32-bit. In VB.NET it is 64-bit. You need to
change it to Integer (32-bit in VB.NET). If making your datatypes the
right size doesn''t fix the issue - then you might want to post the
function declarations (old and new).

--
Tom Shelton



嗨Tom,


感谢您的帮助。很长时间到int32做了伎俩。当我在计算

占星位置时,我发现在访问VBA结果和几个弧形的太阳和月亮的VB.NET之间存在一些小差异
每个我需要退房的
秒,除此之外所有工作都很好

现在好了。很高兴终于得到我的第一个VB.NET解决方案

工作谢谢。


问候

Terry


Tom Shelton < to ********* @ comcast.netwrote in message

news:11 ********************* @ v45g2000cwv.googlegro ups.com ...
Hi Tom,

Thanks for the help. Long to int32 did the trick. As I am calculating
astrological positions I find that there are some small differences between
the Access VBA results and VB.NET for the Sun and Moon of a couple of arc
seconds each that I will need to check out, apart from that all is working
out just fine now. It''s great to finally get my first VB.NET solution
working thanks.

Regards
Terry

"Tom Shelton" <to*********@comcast.netwrote in message
news:11*********************@v45g2000cwv.googlegro ups.com...

>

Terry写道:
>
Terry wrote:

>我有一些旧的VB5函数,它们指定了Long和Double的类型,这些函数可能会调用非托管第三方DLL。 DLL的来源
不可用。

我收到一些警告PInvoke..unbalanced stack ...等等。阅读了这一点并尝试理解这个特殊警告,我发现问题的一部分可能是分配空间不匹配的
变量,例如VB5 Long与VB2005 Long不一样。

另一部分是与CallingConvention有关,为此我不是
所有
太确定如何设置它。

我是否理解了此警告,是否可以采取措施来解决问题?我将补充说我正在将Access 2K3 VBA
应用程序转换为VB.NET 2005.在Access应用程序中,一切正常。

问候
>I have some old VB5 functions that specify types of Long and Double that
make calls to an unmanaged 3rd party DLL probably just as old. The source
for the DLL is not available.

I''m getting some warnings "PInvoke..unbalanced stack..." etc. Reading up
a
bit on this and trying to understand this particular warning, I find that
part of the problem could be in the mismatch of allocated space for the
variables, e.g. VB5 Long is not the same as VB2005 Long.

Another part is to do with the CallingConvention and for this I''m not
all
too sure how to set this up.

Have I understood this warning and is there something that may be done to
correct the problem? I will add that I am converting an Access 2K3 VBA
application to VB.NET 2005. In the Access app all worked OK.

Regards



特里 - 问题很可能是数据大小。直到.NET,你

除了stdcall函数和声明语句之外无法调用任何东西

(没有黑客)。 VB.NET会让你调用cdecl,但是stdcall是

的默认值。


在VB5 / 6中,Long是32位。在VB.NET中它是64位。您需要将
更改为Integer(VB.NET中为32位)。如果你的数据类型是

正确的大小并没有解决问题 - 那么你可能想要发布

函数声明(旧的和新的)。


-

Tom Shelton


Terry - the problem is most likely data size. Up until .NET, you
couldn''t call anything but stdcall functions with declare statements
(without hacks). VB.NET will let you call cdecl, but stdcall is the
default.

In VB5/6 a Long was 32-bit. In VB.NET it is 64-bit. You need to
change it to Integer (32-bit in VB.NET). If making your datatypes the
right size doesn''t fix the issue - then you might want to post the
function declarations (old and new).

--
Tom Shelton



这篇关于VB5 Long&amp;双向VB.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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