Article View: borland.public.cppbuilder.migration
Article #72problem with delphi function which returns array of byte
From: Rolf Fankhauser
Date: Thu, 03 Feb 2005 09:01
Date: Thu, 03 Feb 2005 09:01
38 lines
2282 bytes
2282 bytes
I have problems to use some functions in CBuilder which I wrote in Delphi:
function ConvertCodeToKey(Code: string): TKey;
function CheckRegistration(Name: string; Key: TKey) : boolean;
function ConvertNameToKey(Name: string): TKey;
function ConvertKeyToCode(Key: TKey): string;
TKey is defined as follows:
type
TKey = array [0..15] of Byte;
These functions are converted by CBuilder to:
extern PACKAGE Byte __fastcall ConvertCodeToKey(AnsiString Code);
extern PACKAGE bool __fastcall CheckRegistration(AnsiString Name, const
Byte * Key);
extern PACKAGE Byte __fastcall ConvertNameToKey(AnsiString Name);
PACKAGE AnsiString __fastcall ConvertKeyToCode(const Byte * Key);
My problem is how to access the array of bytes in CBuilder. It returns
only one byte and not the whole array. Or is this the pointer to the array?
I tried it by the following code but CheckRegistration is always false
even with a matching pair of user name and key:
bool Regd = false;
AnsiString RegKey = "2LTNRVJRYSN:][aM";
Byte Key = ConvertCodeToKey(RegKey);
ShowMessage(IntToStr(Key));
if (!CheckRegistration("Rolf Fankhauser",&Key))
Regd = FormRegistration->InputRegistration("REBEKA","TestReg.ini",15);
if (Regd)
ShowMessage("Registered!");
else
ShowMessage("Not registered!");
Any idea how to get the whole array of byte?
Technical Details
Message-ID:
<4201E87C.3050806@switzerland.org>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 110f51,f153cb35baf81ed1,start X-Google-Attributes: gid110f51,public X-Google-Language: ENGLISH,ASCII-7-bit Message-ID: <4201E87C.3050806@switzerland.org> Date: Thu, 03 Feb 2005 10:01:48 +0100 From: Rolf Fankhauser <rolf.fankhauser@switzerland.org> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.1) Gecko/20020826 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.migration Subject: problem with delphi function which returns array of byte Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 82.195.239.8 X-Trace: newsgroups.borland.com 1107421485 82.195.239.8 (3 Feb 2005 01:04:45 -0800) Lines: 39 Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail