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

WPARAM is 8 bytes on 64bit Windows #2

Open
softworkz opened this issue Oct 10, 2024 · 1 comment
Open

WPARAM is 8 bytes on 64bit Windows #2

softworkz opened this issue Oct 10, 2024 · 1 comment

Comments

@softworkz
Copy link

Also it's unsigned, so it actually has to be UIntPtr, even though IntPtr is often used.
int is definitely wrong - it's kind of a mystery (or pure accidence) that it has even been working with int 😉

[DllImport("User32.dll", SetLastError = true, CharSet = CharSet.Auto)]
public static extern int DefWindowProc(IntPtr hWnd, uint uMsg, int wParam, IntPtr lParam);

public delegate int WNDPROC(IntPtr hwnd, uint uMsg, int wParam, IntPtr lParam);

private int Win32WndProc(IntPtr hwnd, uint msg, int wParam, IntPtr lParam)
{
//int wmId, wmEvent;
switch (msg)
{
default:
break;
}
return DefWindowProc(hwnd, msg, wParam, lParam);
}

@castorix
Copy link
Owner

Also it's unsigned, so it actually has to be UIntPtr, even though IntPtr is often used. int is definitely wrong - it's kind of a mystery (or pure accidence) that it has even been working with int 😉

Yes, right.
(I had copied old definitions I used for x86 only, I will fix it asap...)
It is defined like this in DotNet48ZDP2 source by MS :

        [DllImport(ExternDll.User32, CharSet=System.Runtime.InteropServices.CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern IntPtr DefWindowProc(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);

Thanks.

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