thooloon
asked on
Convert Delphi 7 code to Delphi 2005
Can some one help me to convert the below mentioned codes to Delphi 2005.
the code listed below works fine with delphi 7, i want to convert the code to Delphi.Net VCL format.
The code desribed below uses a DLL to retreive data from a proximity reader
code listing
function ExecuteCommand(sComPort : string;sBaudRate : string;sUnitNumber : string;
sCommand :string; sDataToBeSent : string; var pStartAddress : Pointer; var iNoOfTransactions: integer): Boolean;
stdcall;external 'wincomm.dll';
procedure TForm1.Button1Click(Sender : TObject);
var
Transcount:integer;
ptrBuffer : Pointer;
iNoTransactions : integer;
bSuccess : boolean;
comport,Baudrate,UNo,Comma nd,Datatob esent : string;
begin
ptrBuffer := nil;
Transcount := 0;
ComPort := '1';
BaudRate := '9600';
UNo := '01';
Command := 'SD';
//DDMMYYWhhmmss
Datatobesent := '001';
bSuccess := ExecuteCommand(ComPort,Bau dRate,UNo, Command,Da taToBeSent ,
ptrBuffer,iNoTransactions) ;
if bSuccess then ShowMessage('Executed command successfully.')
Else ShowMessage('Failed Execute command.');
end;
Best Regards
Thooloon
the code listed below works fine with delphi 7, i want to convert the code to Delphi.Net VCL format.
The code desribed below uses a DLL to retreive data from a proximity reader
code listing
function ExecuteCommand(sComPort : string;sBaudRate : string;sUnitNumber : string;
sCommand :string; sDataToBeSent : string; var pStartAddress : Pointer; var iNoOfTransactions: integer): Boolean;
stdcall;external 'wincomm.dll';
procedure TForm1.Button1Click(Sender
var
Transcount:integer;
ptrBuffer : Pointer;
iNoTransactions : integer;
bSuccess : boolean;
comport,Baudrate,UNo,Comma
begin
ptrBuffer := nil;
Transcount := 0;
ComPort := '1';
BaudRate := '9600';
UNo := '01';
Command := 'SD';
//DDMMYYWhhmmss
Datatobesent := '001';
bSuccess := ExecuteCommand(ComPort,Bau
ptrBuffer,iNoTransactions)
if bSuccess then ShowMessage('Executed command successfully.')
Else ShowMessage('Failed Execute command.');
end;
Best Regards
Thooloon
It could help a lot if you state witch errors the compiler shows to you and in witch lines.
ASKER
1 function ExecuteCommand(sComPort : string;sBaudRate : string;sUnitNumber : string;
2 sCommand :string; sDataToBeSent : string; var pStartAddress : Pointer; var iNoOfTransactions: integer): Boolean;
3 stdcall;external 'wincomm.dll';
4
5 procedure TForm1.Button1Click(Sender
6 var
7 Transcount:integer;
8 ptrBuffer : Pointer;
9 iNoTransactions : integer;
10 bSuccess : boolean;
11 comport,Baudrate,UNo,Comma
12
13 begin
14 ptrBuffer := nil;
15 Transcount := 0;
16 ComPort := '1';
17 BaudRate := '9600';
18 UNo := '01';
19 Command := 'SD';
20 //DDMMYYWhhmmss
21 Datatobesent := '001';
22 bSuccess := ExecuteCommand(ComPort,Bau
23 ptrBuffer,iNoTransactions)
24 if bSuccess then ShowMessage('Executed command successfully.')
25 Else ShowMessage('Failed Execute command.');
[Error] Unit1.pas(27): E2410 Unsafe pointer variables, parameters or consts only allowed in unsafe procedure - pointing to line 2
[Error] Unit1.pas(33): E2410 Unsafe pointer variables, parameters or consts only allowed in unsafe procedure - pointing to line 8
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.
I will leave the following recommendation for this question in the Cleanup topic area:
- Accept Sergio_Hdez
Any objections should be posted here in the next 4 days. After that time, the question will be closed.
Pierre
EE Cleanup Volunteer
I will leave the following recommendation for this question in the Cleanup topic area:
- Accept Sergio_Hdez
Any objections should be posted here in the next 4 days. After that time, the question will be closed.
Pierre
EE Cleanup Volunteer