INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

I want to convert c++ code to Delphi

I want to convert c++ code to Delphi

(OP)
I want to convert c++ code to Delphi. The c++ code is getting stream from camera(Hikvision).I use a dll in my program, I am using this function in dll:
c++ code:

CODE -->

NET_DVR_API LONG __stdcall NET_DVR_RealPlay_V30(LONG lUserID, LPNET_DVR_CLIENTINFO lpClientInfo, void(CALLBACK *fRealDataCallBack_V30) (LONG lRealHandle, DWORD dwDataType, BYTE *pBuffer, DWORD dwBufSize, void* pUser) = NULL, void* pUser = NULL, BOOL bBlocked = FALSE); 

delphi code (that I convert):

CODE -->

type
    fRealDataCallBack_V30 =procedure(lRealHandle : LongInt; dwDataType: DWORD;pBuffer: PByte; dwBufSize: DWORD; dwUser: DWORD);stdcall;
    function  NET_DVR_RealPlay_V30 ( lUserID: Longint; lpClientInfo: LPNET_DVR_CLIENTINFO; fRealDataCallBack_V30: fRealDataCallBack_V30; pUser: Pointer; bBlocked: Boolean): Longint;stdcall; external 'HCNetSDK.dll'name 'NET_DVR_RealPlay_V30'; 

That function needs callback function:
c++ code :

CODE -->

void CALLBACK fRealDataCallBack(LONG lRealHandle, DWORD dwDataType, BYTE *pBuffer, DWORD dwBufSize, void* dwUser)
        {
        	printf("\nhello");
        } 
Delphi code(that I convert):

CODE -->

procedure RealDataCallBack(lRealHandle: Longint; dwDataType: Longword; pBuffer: LPByte; dwBufSize: Longword; pUser:Pointer);stdcall;
    begin
     ShowMessage('hello');
    end; 

and use that callback function as a parameter in dll function:
c++ code:

CODE -->

NET_DVR_RealPlay_V30(lUserID,&client, fRealDataCallBack,NULL,false); 

delphi code (that I convert):

CODE -->

NET_DVR_RealPlay_V30(iLoginID,@lpClientInfo,RealDataCallBack,nil,false); 

my c++ code is work completely correctly,but my delphi code can't call callback function.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close