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

Standard cursors ressources #19

Open
eddineimad0 opened this issue Jun 9, 2023 · 1 comment
Open

Standard cursors ressources #19

eddineimad0 opened this issue Jun 9, 2023 · 1 comment

Comments

@eddineimad0
Copy link

I saw that definitions for IDC constants is skipped in the window_and_messaging.zig

   // skipped 'IDC_IBEAM'
  // skipped 'IDC_WAIT'
  // skipped 'IDC_CROSS'
  // skipped 'IDC_UPARROW'
  // skipped 'IDC_SIZE'
  // skipped 'IDC_ICON'
  // skipped 'IDC_SIZENWSE'
  // skipped 'IDC_SIZENESW'
  // skipped 'IDC_SIZEWE'
  // skipped 'IDC_SIZENS'
  // skipped 'IDC_SIZEALL'
  // skipped 'IDC_NO'
  // skipped 'IDC_HAND'
  // skipped 'IDC_APPSTARTING'
  // skipped 'IDC_HELP'
  // skipped 'IDC_PIN'
  // skipped 'IDC_PERSON'

i'm guessing that the cause of this is pointer alignment but anyway is there any alternative to these constants in the zigwin32 library?

@Tired-Fox
Copy link

Tired-Fox commented Apr 8, 2024

For anyone looking at this in the future. You can add the following to your own files and it would be a local work around. The key for the fix here is the align(1) for the u16 strings.

const std = @import("std");
const win32 = @import("win32");
const typedConst = win32.zig.typedConst;
const HCURSOR = win32.ui.windows_and_messaging.HCursor;
const HINSTANCE = win32.foundation.HINSTANCE;

pub extern "user32" fn LoadCursorW(
    hInstance: ?HINSTANCE,
    lpCursorName: ?[*:0]align(1) const u16,
) callconv(std.os.windows.WINAPI) ?HCURSOR;

pub const IDC_HAND = typedConst([*:0]align(1) const u16, @as(u32, 32649))
// ... repeat for the rest of the missing constants
// reference the MS docs for their values: https://learn.microsoft.com/en-us/windows/win32/menurc/about-cursors

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

No branches or pull requests

2 participants