Home > Back-end >  Hai kang set osd, what is going wrong
Hai kang set osd, what is going wrong

Time:11-03

Procedure Tfrm_Jsyl. Button23Click (Sender: TObject);
Var
SHOWSTRINGCFG: NET_DVR_SHOWSTRING_V30;
Osd: string;
Buf: array [43] 0.. of Char;
S: a string;
I: Integer;
The begin

SHOWSTRINGCFG. DwSize:=sizeof (SHOWSTRINGCFG);//get structure size
//showmessage (inttostr (lUserID));
Osd:='video test;
SHOWSTRINGCFG. StruStringInfo [0]. WShowString:=1;//1 to show the
Strpcopy (@ buf, osd);
//showmessage (buf [0]);
SHOWSTRINGCFG. StruStringInfo [0]. SString:=buf; -- -- -- -- - "this sentence errors Incompatible types

SHOWSTRINGCFG. StruStringInfo [0]. WStringSize:=120;
SHOWSTRINGCFG. StruStringInfo [0]. WShowStringTopLeftX:=110;
SHOWSTRINGCFG. StruStringInfo [0]. WShowStringTopLeftY:=200;

NET_DVR_SetDVRConfig (lUserID NET_DVR_SET_SHOWSTRING_V30, strtoint (Edit_Ch_no. Text), @ SHOWSTRINGCFG, sizeof (SHOWSTRINGCFG));

Showmessage (inttostr (NET_DVR_GetLastError ()));

end;


SHOWSTRINGCFG. StruStringInfo [0]. SString:=buf; -- -- -- -- - "this sentence errors Incompatible types

Here are NET_DVR_SHOWSTRINGINFO structure, how do I solve???????

{///single character parameters (substructure)}
Type
NET_DVR_SHOWSTRINGINFO=record
WShowString: Word;
WStringSize: Word;
{=the length of the characters, is not greater than 44 characters}
WShowStringTopLeftX: Word;
{=character display position coordinates x}
WShowStringTopLeftY: Word;
{=character name display position y}
44 - sString: Array [0.. 1] of Char.


{=to display character content}
end

CodePudding user response:

Move (buf, SHOWSTRINGCFG struStringInfo [0]. SString, 44)

CodePudding user response:

If it is a Delphi 2010 and above version, Char is UniCode Char, therefore the above Char to AnsiChar instead

CodePudding user response:

Delphi is a bad it's type system design is too strict, sometimes seem to be very weak-minded, in fact, if you put the array [43] 0.. of Char; A separate statement for a type:
Type
[43] 0.. String44=array of Char;
Then the buf, sString are defined as String44 type, can be assigned to each

CodePudding user response:

reference 1st floor BlueStorm response:
move (buf, SHOWSTRINGCFG struStringInfo [0]. SString, 44)



Move (buf, SHOWSTRINGCFG struStringInfo [0]. SString, 44).
SHOWSTRINGCFG. StruStringInfo [0]. SString:=buf;


Like this? Or an error

CodePudding user response:

reference 3 floor early play play nuclear response:
Delphi is a bad it's type system design is too strict, sometimes seem to be very weak-minded, in fact, if you put the array [43] 0.. of Char; A separate statement for a type:
Type
[43] 0.. String44=array of Char;
Then the buf, sString are defined as String44 type, can be assigned to each


I put the buf is defined as
Buf: array 44 - [0.. 1] of Char.


The variable SHOWSTRINGCFG. StruStringInfo [0]. SString, type should be the same.

But still can't assignment

CodePudding user response:

SHOWSTRINGCFG. StruStringInfo [0]. SString:=buf; S 'd' d 'g' d 'f' g 'd
Instead of
Move (buf, SHOWSTRINGCFG struStringInfo [0]. SString, 44).

In addition, the cause of the error, is the inside of the Delphi compiler that record array [43] 0.. of Char and the rest of the array [43] 0.. of Char is not the same type, this is the problem of inaccurate compiler determines type, the user can't change,

CodePudding user response:

The SHOWSTRINGCFG. StruStringInfo [0]. SString:=buf;
Instead of
Move (buf, SHOWSTRINGCFG struStringInfo [0]. SString, 44).

In addition, the cause of the error, is the inside of the Delphi compiler that record array [43] 0.. of Char and the rest of the array [43] 0.. of Char is not the same type, this is the problem of inaccurate compiler determines type, the user can't change,

CodePudding user response:

reference 5 floor kciv reply:
Quote: refer to the third floor early play big play nuclear war reply:

Delphi is a bad it's type system design is too strict, sometimes seem to be very weak-minded, in fact, if you put the array [43] 0.. of Char; A separate statement for a type:
Type
[43] 0.. String44=array of Char;
Then the buf, sString are defined as String44 type, can be assigned to each


I put the buf is defined as
Buf: array 44 - [0.. 1] of Char.


The variable SHOWSTRINGCFG. StruStringInfo [0]. SString, type should be the same.

But still can't assignment


Type
[43] 0.. String44=array of Char;

NET_DVR_SHOWSTRINGINFO=record
WShowString: Word;
WStringSize: Word;
{=the length of the characters, is not greater than 44 characters}
WShowStringTopLeftX: Word;
{=character display position coordinates x}
WShowStringTopLeftY: Word;
{=character name display position y}
SString: String44;

//...
Var
Buf: String44;

CodePudding user response:

Loop a character a character set is ok
  • Related