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

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.