UpdateResource 中使用MAKELANGID 出现问题(50)

  • 主题发起人 主题发起人 cooldren
  • 开始时间 开始时间
C

cooldren

Unregistered / Unconfirmed
GUEST, unregistred user!
Undeclared identifier: 'MAKELANGID' 用的delphi 7,应该包含在windows单元中。可以是好像没有。查了帮助The MAKELANGID macro is defined as follows: #define MAKELANGID(p, s) ((((WORD) (s)) << 10) | (WORD) (p)) 在delphi中这句应该怎么写?谢谢
 
procedure MAKELANGID(var p:Word; S:Word);begin p:= (S shl 10) or P;end;----------------------Delphi的windows单元:(* * A language ID is a 16 bit value which is the combination of a * primary language ID and a secondary language ID. The bits are * allocated as follows: * * +-----------------------+-------------------------+ * | Sublanguage ID | Primary Language ID | * +-----------------------+-------------------------+ * 15 10 9 0 bit * * * * A locale ID is a 32 bit value which is the combination of a * language ID, a sort ID, and a reserved area. The bits are * allocated as follows: * * +-------------+---------+-------------------------+ * | Reserved | Sort ID | Language ID | * +-------------+---------+-------------------------+ * 31 20 19 16 15 0 bit * *){ Default System and User IDs for language and locale. } LANG_SYSTEM_DEFAULT = (SUBLANG_SYS_DEFAULT shl 10) or LANG_NEUTRAL; {$EXTERNALSYM LANG_SYSTEM_DEFAULT} LANG_USER_DEFAULT = (SUBLANG_DEFAULT shl 10) or LANG_NEUTRAL; {$EXTERNALSYM LANG_USER_DEFAULT} LOCALE_SYSTEM_DEFAULT = (SORT_DEFAULT shl 16) or LANG_SYSTEM_DEFAULT; {$EXTERNALSYM LOCALE_SYSTEM_DEFAULT} LOCALE_USER_DEFAULT = (SORT_DEFAULT shl 16) or LANG_USER_DEFAULT; {$EXTERNALSYM LOCALE_USER_DEFAULT}
 
znxia说的对。资源中的语言由两部分组成,即Sublanguage ID和Primary Language ID。在使用中必须组合成语言代码。在C语言中可以用MAKELANGID宏来实现,但DELPHI中没有,只能自己实现。具体如znxia所说。如中文简体Primary Language ID为LANG_CHINESE,值为$04,Sublanguage ID为SUBLANG_CHINESE_SIMPLIFIED,值为$02,其组合过程为: SUBLANG_CHINESE_SIMPLIFIED shl 10 or LANG_CHINESE = $0804
 

Similar threads

后退
顶部