delphi 3 to delphi 7 code convert help needed! - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

delphi 3 to delphi 7 code convert help needed!

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

Comments

  • softmansoftman Posts: 157Member
    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
    [code]

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



    : 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
    :
  • DevelopmentDevelopment Posts: 222Member
    [b][red]This message was edited by Development at 2007-1-12 8:11:33[/red][/b][hr]
    ok that worked fine cheers but now i have other error

    Error: Incompatible types: 'sockaddr_in' and PSOCKADDR'

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

    this is in the misc.pas

    [code]
    const sosa:Integer=SizeOf(TSockAddr);
    [/code]

    any idears on this?
    Slewis



Sign In or Register to comment.