我不断收到“无法在DLL'user32.dll'中找到名为'GetWindowLongPtrA'的入口点". [英] I keep getting "Unable to find an entry point named 'GetWindowLongPtrA' in DLL 'user32.dll'"

查看:162
本文介绍了我不断收到“无法在DLL'user32.dll'中找到名为'GetWindowLongPtrA'的入口点".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 GetWindowLongPtrA ,但我不断收到无法在DLL'user32.dll'中找到名为'GetWindowLongPtrA'的入口点".(也是 SetWindowLongPtrA 遇到相同的错误).我已经尝试了许多在Google上找到的解决方案,但是他们没有解决.

I am trying to use GetWindowLongPtrA but I keep getting the "Unable to find an entry point named 'GetWindowLongPtrA' in DLL 'user32.dll'". (also SetWindowLongPtrA getting the same error). I've tried many solutions found on Google, but they didn't solve it.

这是我编写的函数的声明:

Here is the declaration of the function I've written:

[DllImport("user32.dll")]
public static extern IntPtr GetWindowLongPtrA(IntPtr hWnd, int nIndex);

试图放置 EntryPoint ="GetWindowLongPtrA" ,将 GetWindowLongPtrA 更改为 GetWindowLongPtr ,放置 CharSet = CharSet.Ansi ,使用 CharSet = CharSet.Unicode 等切换到 GetWindowLongPtrW ,它们都不起作用.

Tried to put EntryPoint = "GetWindowLongPtrA", changed GetWindowLongPtrA to GetWindowLongPtr, put CharSet = CharSet.Ansi, switched to GetWindowLongPtrW with CharSet = CharSet.Unicode etc., They all didn't work.

我的计算机正好是"64位"(但是不能调用该64位WinAPI函数吗?).操作系统是Windows 10.

My computer is exactly "64-bit" (but cannot call that 64-bit WinAPI function?). the OS is Windows 10.

但是我的系统驱动器的可用空间已用完.这可能是原因吗?

But my system drive is running out of free space. Is this a possible cause?

该问题的解决方案是什么?

What is the solution for this problem?

推荐答案

user32.dll 的32位版本:

无论目标位数如何,使用 GetWindowLongPtr 均可使用C和C ++ WinAPI代码的原因是,在32位代码中,它是一个调用 GetWindowLong(A | W)的宏..它仅存在于 user32.dll 的64位版本中:

The reason that using GetWindowLongPtr regardless of target bitness works C and C++ WinAPI code is that in 32-bit code it's a macro that calls GetWindowLong(A|W). It only exists in the 64-bit version of user32.dll:

pinvoke.net 上导入 GetWindowLongPtr 的文档

[DllImport("user32.dll", EntryPoint="GetWindowLong")]
private static extern IntPtr GetWindowLongPtr32(IntPtr hWnd, int nIndex);

[DllImport("user32.dll", EntryPoint="GetWindowLongPtr")]
private static extern IntPtr GetWindowLongPtr64(IntPtr hWnd, int nIndex);

// This static method is required because Win32 does not support
// GetWindowLongPtr directly
public static IntPtr GetWindowLongPtr(IntPtr hWnd, int nIndex)
{
     if (IntPtr.Size == 8)
     return GetWindowLongPtr64(hWnd, nIndex);
     else
     return GetWindowLongPtr32(hWnd, nIndex);
}

这篇关于我不断收到“无法在DLL'user32.dll'中找到名为'GetWindowLongPtrA'的入口点".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆