Delphi and Kylix

Moderators: pritaeas
Number of threads: 7264
Number of posts: 19073

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
delphi 3 to delphi 7 code convert help needed! Posted by Development on 11 Jan 2007 at 6:28 AM
I need a bit of help converting a older bit of delphi 3 code to work with delphi 7

here the error I get:
Types of actual and formal var parameters must be identical


procedure WriteUserData(ru:PRegUser);
var i:Integer;
begin
SetFilePointer(userdb,RegUsers.IndexOfObject(TObject(ru))*soru,nil,FILE_BEGIN);
WriteFile(userdb,ru^,soru,i,nil); // Nil is the problem code.
FlushFileBuffers(userdb);
end;


can anyone help?

thanks alot
Slewis
Report
Re: delphi 3 to delphi 7 code convert help needed! Posted by softman on 11 Jan 2007 at 8:27 AM
Hi!

I Think the problem is not the nil parameter

The number of Written bytes parameter is DWord, not integer
so try to definie I as "var i:DWord;" instead of integer

Here is the API declaration for WriteFile

The BOOL WriteFile(
  HANDLE hFile,
  LPCVOID lpBuffer,
  DWORD nNumberOfBytesToWrite,
  LPDWORD lpNumberOfBytesWritten,
  LPOVERLAPPED lpOverlapped
);




: I need a bit of help converting a older bit of delphi 3 code to work with delphi 7
:
: here the error I get:
: Types of actual and formal var parameters must be identical
:
:
: procedure WriteUserData(ru:PRegUser);
: var i:Integer;
: begin
: SetFilePointer(userdb,RegUsers.IndexOfObject(TObject(ru))*soru,nil,FILE_BEGIN);
: WriteFile(userdb,ru^,soru,i,nil); // Nil is the problem code.
: FlushFileBuffers(userdb);
: end;
:
:
: can anyone help?
:
: thanks alot
: Slewis
:
Report
Re: delphi 3 to delphi 7 code convert help needed! Posted by Development on 12 Jan 2007 at 8:04 AM
This message was edited by Development at 2007-1-12 8:11:33

ok that worked fine cheers but now i have other error

Error: Incompatible types: 'sockaddr_in' and PSOCKADDR'

 newuser.Socket:=accept(Socket,sockaddr,sosa); // SOSA is problem


this is in the misc.pas

   const sosa:Integer=SizeOf(TSockAddr);


any idears on this?
Slewis






 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.