Home > Back-end >  Delphi2007 code upgrade to Delphi xe2 problems
Delphi2007 code upgrade to Delphi xe2 problems

Time:11-14

Is similar to the problem of incompatible type
[DCC Error] Reader. Pas (99) : E2010 Incompatible types: 'NativeUInt' and 'Cardinal'
How do I deal with? Please masters to guide you!

In addition, if there is a high PCSC read card version of the sample code, thank you!

CodePudding user response:

If you compile a program as a Win64 NativeUInt=UInt64,
If you compile a program as a Win32 NativeUInt=UInt32

For Cardinal, whether it is compiled to Win64 program or Win32, Cardinal=Uint32

So these two data types are not compatible,

CodePudding user response:

Can put the Cardinal UNativeInt instead give it a try

CodePudding user response:

Instead of Cardinal THandle

Don't have much external control, it is recommended to use 10.2.3 Tokyo, compatibility is better than the old version

CodePudding user response:

reference 1st floor BlueStorm response:
if you compile a program as a Win64 NativeUInt=UInt64,
If you compile a program as a Win32 NativeUInt=UInt32

For Cardinal, whether it is compiled to Win64 program or Win32, Cardinal=Uint32

So these two data types are not compatible,
original delphi2007 can only compile a 32-bit, so use Delphi xe2 used to compile a 64 - bit, trouble ask, how to solve this problem,
problem is this code: property CardHandle: THandle read FCardHandle;
Call external DLLS,

CodePudding user response:

Fundamental problem is not the problem of data types, this is easy to change it, if you compiled for 64 - bit code, and that it relies on reading card equipment DLL should also have a 64 - bit version,

CodePudding user response:

THandle is actually NavtiveUInt, you look at the following two methods that suit you:

Solution 1:
The property CardHandle: THandle read FCardHandle;
To the property CardHandle: Cardinal read FCardHandle;

Solution 2:
The type of the FCardHandle THandle instead

CodePudding user response:

refer to 6th floor BlueStorm response:
THandle NavtiveUInt namely actually, you look at the following two methods that suit you:

Solution 1:
The property CardHandle: THandle read FCardHandle;
to property CardHandle: Cardinal read FCardHandle;

Solution 2:
Change the type of FCardHandle to THandle
1 modified according to the method, to compile, but cannot read card, can you give a mail, I send you the code, troubles to assist processing, worried, my email address: huangwqiang#163.com

CodePudding user response:

Estimation problem is you don't use the 64 bit Dll,
I'm sorry, I'm very busy, no time to help you fully processed,

CodePudding user response:

refer to the second floor shallow water cham cham response:
Quote: refer to the sixth floor BlueStorm response:

THandle is actually NavtiveUInt, you look at the following two methods that suit you:

Solution 1:
The property CardHandle: THandle read FCardHandle;
to property CardHandle: Cardinal read FCardHandle;

Solution 2:
Change the type of FCardHandle to THandle
1 modified according to the method, to compile, but cannot read card, can you give a mail, I send you the code, troubles to assist processing, worried, my email address: huangwqiang#163.com

Don't know whether the original poster has already solved the problem, I use PCSC reader also encountered the same problem today, delphi7 can run normally read card, delphi10 appear compile error, I 1 modified in accordance with the law, can be compiled through, also cannot read card, later found a two variable declaration problem, caused by the two variable declaration from PChar into PAnsiChar can
  • Related