【问题标题】:Where can I find the Locale Information Constants in Rust's winapi crate?我在哪里可以找到 Rust 的 winapi 板条箱中的语言环境信息常量?
【发布时间】:2019-02-22 10:24:38
【问题描述】:

Windows NLS API Locale Information Constants 是否在 winapi-rs crate 或 Rust 生态系统的其他地方可用?

我需要从 Rust 调用 GetLocaleInformationEx 并在 winapi-rs crate (here) 的 um::winnls 模块中找到它。

LCType 输入是 Locale Information Constant——我无法在 crate 的任何地方找到这些定义。

作为一种解决方法,我查看了数值并对其进行了硬编码,但我总觉得我错过了一些东西。

【问题讨论】:

标签: winapi rust


【解决方案1】:

在 ntdef.rs 中定义了一些常量。如果您想使用那里不可用的东西,您需要通过Locale Information Constants 查找值并传递原始值或最好自己定义它们。

use self::winapi::shared::ntdef::{LOCALE_SYSTEM_DEFAULT, LOCALE_USER_DEFAULT};

另外,请务必在 Cargo.toml 中配置为使用 winnls,否则在尝试使用 GetLocaleInformationEx 时会出现未解决的导入错误。

[dependencies] winapi = {version = "0.3", features = ["winuser", "std", "libloaderapi", "errhandlingapi", "winnls"] }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-26
    • 1970-01-01
    相关资源
    最近更新 更多