Главная страница | назад





Article #16996: Defining PRIMARYLANGID(), SUBLANGID(), and MAKELANGID() macros

 Question and Answer Database

FAQ1996D.txt   Defining PRIMARYLANGID(), SUBLANGID(), and MAKELANGID() macros
Category   :Windows API
Platform    :All
Product    :All 32 bit  

Question:
How can I define the PRIMARYLANGID(), SUBLANGID() and MAKELANGID()
macros that are used with the Windows API functions that accept
language identifiers?


Answer:
The follow example demonstrates functional equivalents for the
PRIMARYLANGID(), SUBLANGID(), and MAKELANGID() macros.

function PRIMARYLANGID(lgid : Word) : LongInt;
begin
  result := lgid and $3FF;
end;

function SUBLANGID(lgid : Word) : LongInt;
begin
  result := lgid shr 10;
end;

function MAKELANGID(sPrimaryLanguage : Word;
                    sSubLanguage : Word) : Word;
begin
  result := (sSubLanguage shl 10) or
             sPrimaryLanguage;
end;

7/16/98 4:31:28 PM
 

Last Modified: 01-SEP-99