Convert C++ to Delphi 2 lines of code..

W Toku Opublikowano Jun 24, 2013 Płatność przy odbiorze
W Toku Płatność przy odbiorze

OK In C++ I have the following definitions and code.

Structure of preview information.

struct{

LONG lChannel;

LONG lLinkMode;

HWND hPlayWnd;

char *sMultiCastIP;

}NET_DVR_CLIENTINFO, *LPNET_DVR_CLIENTINFO;

Members

lChannel = channel number

lLinkMode = If 31st bit is 0, it means connecting main stream, 1 means sub stream. Bit 0~bit 30 are used for link mode: 0-TCP, 1-UDP, 2-multicast, 3-RTP

hPlayWnd = Handle of playing window. If the value is NULL, it doesn't display image

sMultiCastIP = Multicast IP address

So in delphi I made the following code in the past.

PNetDvrClientInfo = ^TNetDvrClientInfo;

TNetDvrClientInfo = record

lChannel: LONG;

lLinkMode: LONG;

hPlayWnd: HWND;

sMultiCastIP: PChar;

end;

zClient: TNetDvrClientInfo;

[url removed, login to view]:=1;

[url removed, login to view]:=0;

[url removed, login to view]:=[url removed, login to view];

[url removed, login to view]:=PAnsiChar('[url removed, login to view]');

With this code everything works.

The above code connects me to the "Main Stream" and Uses TCP for the connection. Just like it should.

if I change [url removed, login to view]:=1 the above code connects me to the "Main Stream" and Uses UDP for the connection. Just like it should.

if I change [url removed, login to view]:=3 the above code connects me to the "Main Stream" and Uses RTP for the connection. Just like it should.

My problem is I want to connect to the substream. Which according to the c++ definition I need to change the 31st bit to a 1 and not a 0. My question is how do I do this in delphi. So for a MainStream, TCP Connection bit 0~31should be 0 and bit 31 should be 0. For a SubStream, TCP Connection bit 0~31 should be 0 and bit 31 should be 1. How do I do this in delphi.

What should [url removed, login to view]:=??? in order to get the sub stream using tcp by changing the 31st bit to a 1 and not a 0?

Please let me know if there are any questions.

Programowanie w C++ Delphi

Numer ID Projektu: #4657092

O projekcie

1 oferta Zdalny projekt Aktywny Jun 24, 2013