Home > Back-end >  Vc6 code into delphi2007 code
Vc6 code into delphi2007 code

Time:10-07

LPCWSTR lpText=L "LED display";
At this point, through lpText can obtain this text UNICODE, lpText pointing now is only a 16 bit buffer, to obtain in the form of WORD, the result is: "004 c 0045 0044 663 793 a 5 e c4f", represented as a byte array, is: "4 c 00 00 00 44 45 3 e 66 3 a 79 4 f 5 c",

5, send text UNICODE, what to do processing
Control card when receiving text, receiving its UNICODE is not intact, but to do some processing, in order to control card, according to the specific processing code is:
(including lpStr is to convert raw UNICODE strings, pBuff translation is used for storing the results of buffer)



Void CopyWchar (LPCWSTR lpStr, WORD * pBuff)
{
Int nCount, nLen=0;
NCount=wcslen (lpStr);
WCHAR ch;
for(int i=0; i{
Ch=lpStr [I];
If (ch & gt;=0 x80)
{
If (ch & lt;=0 XFF)
Ch -=0 x80;
Else if (ch & gt;=0 x2000 & amp; & Ch & lt;=0 x266f)
Ch=ch - 0 x2000 + 128;
Else if (ch & gt;=0 x3000 & amp; & Ch & lt;=0 x33ff)
Ch=ch x3000 0 + 1648 + 128;
Else if (ch & gt;=0 x4e00 & amp; & Ch & lt;=0 x9fa5)
Ch=ch x4e00 0 + 1648 + 1024 + 128;
Else if (ch & gt;=0 xf900 & amp; & Ch & lt;=0 XFFFF)
Ch=ch xf900 0 + 1648 + 1024 + 20902 + 128.
Ch +=128;
}
PBuff [I]=ch;
}
}

Converting code section delphi2007 code

  • Related