net项目的数据类型

net项目的数据类型

本文介绍了64位vb.net项目的数据类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个旧的vb6项目.现在我在vs2008上的vb.net中迁移它,现在我必须使用64位解决方案平台.在旧代码中,变量hContext被声明为Integer.

I have a old vb6 project.Now I migrating it in vb.net on vs2008 and the solution plateform now I have to use 64bit.In the old code the variable hContext was declared as Integer.

Dim hContext As Integer



并用作



And used as

Dim rc As Integer
dwScope = SCARD_SCOPE_USER
rc = SCardEstablishContext(dwScope, 0, 0, hContext)



当我调试代码时,hContext创建问题.
这是因为它定义为Integer(32bit).
现在的问题是我应该为hContext使用哪种数据类型".我还使用了Long,ULong等不同的数据类型.



When I debug the code the hContext create problem.
This is due to it define as a Integer(32bit).
Now the problem is "What datatype should I use for hContext".I have also used different datatype like Long,ULong.

推荐答案

Private Shared Function SCardEstablishContext(scope As System.UInt32, reserved1 As System.IntPtr, reserved2 As System.IntPtr, ByRef context As System.IntPtr) As Long



—SA



—SA


LONG WINAPI SCardEstablishContext(
  __in   DWORD dwScope,
  __in   LPCVOID pvReserved1,
  __in   LPCVOID pvReserved2,
  __out  LPSCARDCONTEXT phContext
);



如您所见,返回类型是long,在32位和64位系统上为8个字节.



As you can see the return type is a long which is 8 bytes on 32bit and 64bit systems.


这篇关于64位vb.net项目的数据类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 08:23