Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: String constants like PROGRESS_CLASSA should be directly usable #2088

Closed
monax3 opened this issue Oct 8, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@monax3
Copy link

monax3 commented Oct 8, 2022

Motivation

Currently, string constants such as the common control class names are generated as &str which results in duplicated frustrating to use constants:

pub const PROGRESS_CLASS: &'static str = "msctls_progress32";
pub const PROGRESS_CLASSA: &'static str = "msctls_progress32";
pub const PROGRESS_CLASSW: &'static str = "msctls_progress32";

The purpose of these constants is to be able to use them directly when creating a window so they should exist in a form where they can be passed directly to CreateWindowExA/CreateWindowExW, either as a PCSTR/PCWSTR (preferably) or as a &CStr/&HSTRING or [u8]/[u16].

Before:

let progress_class = std::ffi::CString::new(PROGRESS_CLASS).unwrap();
let hwnd = CreateWindowA(.., PCSTR(progress_class.as_ptr().cast::<u8>()), ..);

After:

let hwnd = CreateWindowA(.., PROGRES_CLASSA, ..);

Drawbacks

No response

Rationale and alternatives

No response

Additional context

No response

@monax3 monax3 added the enhancement New feature or request label Oct 8, 2022
@kennykerr
Copy link
Collaborator

Yes, I have already created an issue for the win32 metadata to capture this information here: microsoft/win32metadata#1008

Feel free to chime in on that issue and hopefully they will get it implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants