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,Command,Datatobesent : string;

begin
  ptrBuffer := nil;
  Transcount := 0;
  ComPort := '1';
  BaudRate := '9600';
  UNo := '01';
  Command := 'SD';
  //DDMMYYWhhmmss
  Datatobesent := '001';
  bSuccess := ExecuteCommand(ComPort,BaudRate,UNo,Command,DataToBeSent,
  ptrBuffer,iNoTransactions);
  if bSuccess then ShowMessage('Executed command successfully.')
  Else ShowMessage('Failed Execute command.');

end;


Best Regards
Thooloon
LVL 1
thooloonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sergio_HdezCommented:
It could help a lot if you state witch errors the compiler shows to you and in witch lines.
thooloonAuthor Commented:

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: TObject);
6   var
7   Transcount:integer;
8   ptrBuffer : Pointer;
9   iNoTransactions : integer;
10 bSuccess : boolean;
11 comport,Baudrate,UNo,Command,Datatobesent : string;
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,BaudRate,UNo,Command,DataToBeSent,
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
Sergio_HdezCommented:
OK, .NET doesn't allow you to use a pointer as freely as other languajes, because pointers can point to unexisting structures (use free and pointer still point at the same address) so to avoid this danger, you simply can't use it.

But there is a way: you can only do those "dirty dangerous things" inside funtions/procedures declared as "unsafe", so look at the help for the "unsafe" word. I think your code (line 1) will finally look just like it, but don't copy-paste, look at the help first:

1   function ExecuteCommand(sComPort : string;sBaudRate : string;sUnitNumber : string; ...all the rest here... ); Boolean; unsafe;

I don't have D2005 installed on this machine so you will need to check it.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Pierre CorneliusCommented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.