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

Add a Broadcast property to HWND for clearer semantics #1699

Closed
vitkuz573 opened this issue Sep 9, 2023 · 5 comments · Fixed by #1702
Closed

Add a Broadcast property to HWND for clearer semantics #1699

vitkuz573 opened this issue Sep 9, 2023 · 5 comments · Fixed by #1702

Comments

@vitkuz573
Copy link

I've been working with the HWND structure and realized that it might be beneficial to have a Broadcast property directly in the HWND structure to represent the broadcast handle, rather than casting it manually each time using (HWND)0xFFFF.

Proposal:
Add a static property to HWND that represents the broadcast handle. This would make the code more readable and reduce the potential for errors.

public static HWND Broadcast => new HWND(0xFFFF);

@elachlan
Copy link
Contributor

elachlan commented Sep 9, 2023

What projection are you using? That is usually done in those.

@vitkuz573
Copy link
Author

I'm using CsWin32

@elachlan
Copy link
Contributor

elachlan commented Sep 9, 2023

https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-sendmessage

I guess we should add a new const in the metadata HWND_BROADCAST ((HWND)0xffff) similar to HWND_TOP and the others.

@elachlan
Copy link
Contributor

elachlan commented Sep 9, 2023

It exists in the headers:

/*
* Special HWND value for use with PostMessage() and SendMessage()
*/
#define HWND_BROADCAST ((HWND)0xffff)

@elachlan
Copy link
Contributor

elachlan commented Sep 9, 2023

The ConstantsScraper does not handle the value 0xffff, if I replace the value in the header with 65535 it gets picked up.

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

Successfully merging a pull request may close this issue.

2 participants