? DWORD? Word? Byte? Mutual conversion ???? DWORD ?? 4 bytes ?? Word ????? 2 bytes ?? Byte ??????? 1 byte?
1 )? DWORD ---> word
???? DWORD? DW = 0 ;?????????????????? Word? HW = hiword (DW );?????? Word? Lw = loword (lw );??
2) Word ---> DWORD
???? DWORD? DW = 0 ;?????????????????? Word? HW = hiword (DW );?????? Word? Lw = loword (lw );?????????????????? DW = makelong (LW, HW );??
3 )? Word ----> byte
???? Word? WORD = 0 ;?????? Byte? HB = hibyte (Word );?????? Byte? Lb = lobyte (Word );??
4) byte ------> word
???? Word? WORD = 0 ;?????? Byte? HB = hibyte (Word );?????? Byte? Lb = lobyte (Word );???????????? Word? =? Makeword (LB, Hb );??
5 )? "ABCD "? Or l "hello "? What is such a four-byte string? Convert to DWORD? Save
???? Wchar? STR [3] = {L "hello "};???????????? Memcpy (& DWORD, STR, 4 );?????????????????? Wchar? Hchar = (wchar) hiword (DWORD );? //? Okay ?????? Wchar? Lchar = (wchar) loword (DWORD );? //? You ??
Example:
???????? Char ?? * Name = "ABCD ";?????????? DWORD? DWORD = 0 ;?????????????????????? Word? HW = hiword (DWORD );?????????? Word? Lw = loword (DWORD );???????????????? Byte? Hhb = hibyte (HW );?????????? Byte? LHB = lobyte (HW );???????????????? Byte? HLB = hibyte (lw );?????????? Byte? LLB = lobyte (lw );???????????????????????????? Hhb ??? = ??? Name [0]; ??? HLB ??? = ??? Name [1]; ??? LHB ??? = ??? Name [2]; ??? LLB ??? = ??? Name [3]; ??? HW ??? = ??? Makeword (HLB ,??? Hhb );?? // Ba ?????????? LW ??? = ??? Makeword (LLB ,??? LHB );?? // Dc ???????????????? // DWORD? Is it? "Dcba "?????????? DWORD ??? = ??? Makelong (LW ,??? HW );? // Dcba ???????????????? HW = hiword (DWORD );? //? Ba ?????????? Lw = loword (DWORD );? //? DC ???????????????? Hhb = hibyte (HW );?? //? A ?????????? LHB = lobyte (HW );?? //? B ???????????????? LHB = hibyte (lw );?? //? C ?????????? LLB = lobyte (lw );?? //? D ???????????????????????? ///////////////////////?? Comparison Program ?? //////////////////////////////////////// ///////////???????????????? //? DWORD? Is it? "ABCD "?????????? Memcpy (& DWORD, name, 4 );???????????????? HW = hiword (DWORD );? //? CD ?????????? Lw = loword (DWORD );? //? AB ???????????????? Hhb = hibyte (HW );??? //? D ?????????? LHB = lobyte (HW );??? //? C ???????????????? LHB = hibyte (lw );??? //? B ?????????? LLB = lobyte (lw );??? //? A ??
Used in this article? Calligraphy and painting novel software? Released, the content has nothing to do with the software, and the painting and calligraphy novel software? More comfortable reading, more comfortable writing, and easier Publishing.
DWORD? Word? Byte? Mutual conversion ?. XML